Kochol Game Engine  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kge::sn::TileTerrain2 Class Reference

#include <TileTerrain2.h>

Inheritance diagram for kge::sn::TileTerrain2:
kge::sn::TileTerrain kge::sn::SceneNode kge::KgeUnknown

Classes

struct  MapIDData

Public Member Functions

 TileTerrain2 ()
 Constructor.
 ~TileTerrain2 ()
 Destructor.
void ReCreate (int numCols, int numRows, float MinHeight=0.0f, float MaxHeight=0.0f)
 Create the terrain if already created then recreate it.
void CreateShaderCode (core::String &VertexCode, core::String &PixelCode)
 Creates the terrain shader code.
void CreateDeferredShaderCode (core::String &VertexCode, core::String &PixelCode)
 Creates the terrain shader code for deferred shading.
void Render ()
 Render the terrain.
void SetBrush (char *FileName)
 Sets the brush texture and shape.
void SetBrushSize (float fSize)
 Sets the brush size.
void BrushTile (float x, float y, int tileid, float BlendFactor, bool ChangeBackground=false, bool Mode2=false)
 Brush the tiles.
void SetTile (int Col, int Row, u32 TileID)
 Sets the tile in the terrain.
void SetTileTexture (gfx::Texture *pTileTex, int Width, int Height, int HorizantalTilesCount, int VerticalTilesCount, int TileSizeInPixel)
 Sets the tile texture.
int GetMapsCount () const
const u8GetBlendMapsData (int n) const
const u8GetTextureIDMapsData (int n) const
void SetBlendMapsData (int n, u8 *data, int size)
void SetTextureIDMapsData (int n, u8 *data, int size)
- Public Member Functions inherited from kge::sn::TileTerrain
 TileTerrain ()
 Constructor.
virtual ~TileTerrain ()
 Destructor.
virtual void PreRender (float elapsedTime=0.0f)
 Karhayee ke Ghabl az render bayad anjam shvad. Mesle colision detection.
virtual void PostRender ()
 Karhaee ke bad az render bayad anjam beshe.
virtual bool AddEffect (efx::EffectType p, efx::Effect **ppOut)
virtual void Draw (bool WithMaterial, bool WithTransform, bool bPosition, bool bNormalTexcoord, bool bTangentBinormal)
void SetTileTexture (gfx::TileTexture *pTileTex)
 Sets the tile texture.
void SetNormalMapTileTexture (gfx::TileTexture *pTileTex)
 Sets the tile texture.
gfx::TileTextureGetTileTexture ()
 Returns the tile texture pointer then you can modify it directly.
void SetTiles (u32 tileID)
 Sets the tiles.
void Blend (int Col, int Row)
 Blend the tile stored in the given position and their same tiles attached to it.
void Fill (int Col, int Row, int TileID)
 Fill the terrain with the given tile ID.
float GetHeight (float x, float z)
 Returns the terrain height at the given grid position.
void SetHeight (int IndexID, float h)
 Sets the terrain height by the index id.
void SetHeight (int Col, int Row, float h)
 Sets the terrain height by the tile position.
void SetVertexColor (int IndexID, gfx::Color c)
 Sets the terrain color by the index id.
void SetVertexColor (int Col, int Row, gfx::Color c)
 Sets the terrain color by the tile position.
void SetHeightAdd (int IndexID, float h)
 Adds the terrain height by the index id.
void SetHeightAdd (int Col, int Row, float h)
 Adds the terrain height by the tile position.
void Smooth (int Col, int Row)
 Smooths the tile height.
void SmoothOneNode (int Col, int Row)
 Smooths one node height.
math::Vector2I GetTileByFaceID (int FaceID)
 Gets the column number and row number by Face index.
gfx::Vertex3GetPositions ()
 Returns the terrain position vertices.
void GetYs (float *inArray)
 Create an array of Y position vertices and return.
void SetYs (float *pHeights)
 Sets the heights.
int GetTiles (int *pTiles1, int *pTiles2)
 Returns the tile count if you pass the NULL and set them otherwise.
void SetTiles (int *pTiles1, int *pTiles2)
 Sets the tiles.
int GetBlendMap (u8 *pBlendMap)
 Returns blend map size if you pass NULL and set the pointer otherwise.
void SetBlendMap (u8 *pBlendMap)
 Sets the blend map.
void GetVertexColors (ul32 *pVertexColor)
 Copy the vertex colors to the pointer.
void SetVertexColors (ul32 *pVertexColor)
 Copy the vertex colors from the pointer.
int GetVertexCount ()
 Returns the count of the vertexes.
u32GetIndices ()
 Returns the terrain indexes.
int GetIndexesCount ()
 Returns the terrain indexes count.
ph::DynamicTriangleMeshGetDynamicTriangleMesh ()
 Returns the DynamicTriangleMesh pointer.
void SetDynamicTriangleMesh (ph::DynamicTriangleMesh *pDTM)
 Returns the DynamicTriangleMesh pointer and send updates to it if needed.
void UpdateNormals ()
 Recalculate the terrain normals.
int GetAABBcount ()
 Return the number of AABB that splited the terrain.
math::AABBGetAABBs ()
 Returns the AABBs array pointer.
int GetUcount ()
 Returns the number of ... in U.
int GetVcount ()
 Returns the number of ... in V.
DecalCreateDecal (int sizeX, int sizeY, gfx::Texture *pTex)
 Create a decal and return its pointer.
void SetDecal (float fx, float fy, Decal *pDecal)
 Sets the decal on position.
virtual u32 GetMaterialCount ()
 Get the count of materials this terrain has. always returns 1.
virtual gfx::MaterialGetMaterial (u32 Index)
 Get the terrain material.
void EnableWater (bool Enable, const gfx::Colorf &cStart=gfx::Colorf(255, 255, 255), const gfx::Colorf &cEnd=gfx::Colorf(0, 229, 255))
 Enables the under water vertex coloring effect.
void SetCaustics (gfx::Texture **ppTextures, int TexturesCount, int speed=100)
 Enable and sets the caustics textures.
void SetBlendMap (gfx::Texture *pTexture)
 Sets the Blend Map.
void ReceiveShadow (const char *Code, math::Matrix *shadowmat)
 Sets the shadow receiver params.
int GetColumnsCount ()
 Returns the columns count.
int GetRowsCount ()
 Returns the rows count.
void RenderDecals ()
 Render decals.
void RemoveDecal (Decal *pDecal)
 Empty space in vertex buffer.
void OnLost ()
void OnReset ()
 Refills vertex and index buffers after reseting device.
void RecreateShaders ()
- Public Member Functions inherited from kge::sn::SceneNode
 SceneNode ()
 Constructor.
virtual ~SceneNode ()
 Destructor.
virtual void AddChild (SceneNode *child)
 Adds a node as child.
virtual void SetSceneManager (SceneManager *smgr)
 Sets the scene manager and renderer pointer.
virtual void SetPosition (const math::Vector &v)
 Set the position of the scenenode.
virtual void SetRotation (const math::Vector &v)
 Set the rotation of the scenenode.
virtual void SetScale (const math::Vector &v)
 Set the scale of the scenenode.
virtual void SetAutomaticCulling (bool isTrue)
 Set Cutting Enable or Disable.
virtual void SetVisible (bool isVisible)
 Set Visible Enable or Disable.
virtual bool GetVisible ()
 Get Visible.
virtual bool IsVisibleInFrame ()
 Is it visible in this frame?
virtual const math::VectorGetPosition () const
 Returns the node position.
virtual const math::VectorGetRotation () const
 Returns the node rotation.
virtual const math::VectorGetScale () const
 Returns the node scale.
virtual math::MatrixGetAbsoluteMatrix () const
 Get the absolute matrix.
virtual math::MatrixGetFinalMatrix ()
 Get the final matrix.
virtual math::SphereGetBoundingBox ()
 Returns the node bounding box.
virtual math::AABBGetAxisAlignedBoundingBox ()
 Returns the node Axis aligned bounding box.
virtual NodeType GetType () const
 Returns the node type.
virtual void RemoveChild (SceneNode *child)
virtual void RemoveChildren ()
 Removes all children of this node.
virtual const SceneNodeGetParent ()
 Returns the node parent.
virtual void SetParent (SceneNode *parent)
 Sets the node parent.
virtual void SetName (const char *name)
 Sets the node name.
virtual core::StringGetName ()
 Gets the node name.
virtual void SetID (int ID)
 Sets the node ID.
virtual int GetID ()
 Gets the node ID.
void EnableShadow (bool enable)
bool HasShadow () const
virtual void UpdateFinalMat ()
 Update final matrix.
- Public Member Functions inherited from kge::KgeUnknown
 KgeUnknown ()
 Constructor.
virtual ~KgeUnknown ()
 Destructor.
virtual void AddRef ()
 Add a reference to the object.
virtual void DecRef ()
 Decrease a reference from the object. if its reference count get 0 then the object will destroy.
u32 GetRefCount ()
 Return resource reference count.
const char * GetDebugText ()
 returns the instance debug text.

Protected Member Functions

std::vector
< TileTerrain2::MapIDData
GetBlendMapIDs (float x, float y)
void SetBrushShaderParams (gfx::ShaderInstance *pSI)
void userSetShaderParams ()
- Protected Member Functions inherited from kge::sn::TileTerrain
void Flood_Fill (int Col, int Row, int TileID)
void Flood_Fill (int Col, int Row, int ReplaceID, int TileID)
void SetTile (int Col, int Row, int TileID, int TileID2)
virtual void SetShaderParams ()
void SetDecalShaderParams (gfx::ShaderInstance *pSI)
- Protected Member Functions inherited from kge::sn::SceneNode
virtual bool HasThisEffect (efx::EffectType p)
- Protected Member Functions inherited from kge::KgeUnknown
void SetDebugText (char *text)

Protected Attributes

gfx::Texture ** m_ppBlendMaps
 Blend maps.
gfx::Texture ** m_ppTextureIDMaps
int m_iMapsCount
 counts
int m_iMapsSize
int m_iMapsCX
int m_iMapsCY
int m_iTileW
int m_iTileH
int m_iTileSizeInPixel
int m_iBitCount
float m_fVTilesCountInverse
float m_fHTilesCountInverse
gfx::Texturem_pBrush
gfx::Imagem_pImgBrush
gfx::Imagem_pImgScaledBrush
gfx::Shaderm_pVsBrush
gfx::Shaderm_pPsBrush
gfx::ShaderHandle m_shBrushBlend
gfx::ShaderHandle m_shDirLightColor
float m_fBrushSize
kge::math::Matrix m_m2D
- Protected Attributes inherited from kge::sn::TileTerrain
std::vector< TileTerrainDatam_vTerrainData
 Terrain data.
std::vector< int > m_vVisibleParts
 Visible parts.
gfx::Vertex3m_pPos
 Vertices.
gfx::VertexNTCm_pNorTexColor
sn::Meshm_pMesh
gfx::Vertex3Cm_pNormalVerts
 Normal lines.
gfx::Color m_cNormal [4]
 Normal lines color.
u32m_pIndices
 Indices.
int * m_pTiles
 Tile infos.
int * m_pTiles2
int * m_pTilesTemp
u8m_pBlendTiles
float m_fWidth
 Tile width and height size.
float m_fHeight
float m_fXOffset
float m_fYOffset
int m_iNumVerts
 Count.
int m_iNumIndices
int m_iNumCols
int m_iNumRows
int m_iNumColspp
int m_iNumRowspp
int m_iNumUparts
int m_iNumVparts
int m_iNumCausticsTextures
int m_iCurrentCaustic
int m_iTextureIDSizeX
int m_iTextureIDSizeY
core::Timerm_pCausticsTimer
gfx::ShaderHandle m_shLit
gfx::ShaderHandle m_shWVP
gfx::ShaderHandle m_shView
gfx::ShaderHandle m_shShadowMat
gfx::ShaderHandle m_shfvEyePosition
bool m_bWater
bool m_bCaustics
bool m_bPosChanged
bool m_bNorTexChanged
bool m_bReceiveShadow
bool m_bTileTerrain2
const char * m_pShadowShaderCode
 Shadow code.
math::Matrixm_pShadowMatrix
gfx::Texture ** m_ppCausticsTextures
gfx::Texturem_pTextureID
 Terrain Texture ID for storing the tile data.
gfx::Texturem_pTextureBlend
gfx::Texturem_pBlendMap
gfx::Colorf m_cStart
gfx::Colorf m_cEnd
gfx::TileTexturem_pTileTexture
 Tile texture pointer.
gfx::TileTexturem_pNormalMapTileTexture
ph::DynamicTriangleMeshm_pDTM
 Dynamic Triangle Mesh class pointer.
gfx::Materialm_pMaterial
 Material.
gfx::Shaderm_pVSdecal
 Decal shader.
gfx::Shaderm_pPSdecal
kge::core::Functor1< void,
gfx::ShaderInstance * > * 
m_pDecalFun
gfx::ShaderHandle m_shDecalWVP
gfx::ShaderHandle m_shDecalAlpha
std::map< u32, DecalData * > m_mDecalBufferData
- Protected Attributes inherited from kge::sn::SceneNode
core::String m_sName
int m_iID
SceneManagerm_pSnMan
gfx::Rendererm_pRenderer
bool m_bVis
bool m_bAutoCulling
bool m_bVisFrame
SceneNodem_pParent
std::vector< SceneNode * > m_vChilds
std::vector< int > m_vEffectType
std::vector< efx::Effect * > m_vEffect
math::Matrixm_pAbsMat
math::Matrixm_pFinalMat
math::Vector m_Position
math::Vector m_Rotation
math::Vector m_Scale
math::Spherem_pBB
math::AABBm_pAABB
NodeType m_eNodeType
bool m_hasShadow

Additional Inherited Members

- Public Attributes inherited from kge::sn::TileTerrain
gfx::Shaderm_pVshader
 Shaders.
gfx::Shaderm_pPshader

Detailed Description

Definition at line 24 of file TileTerrain2.h.

Constructor & Destructor Documentation

kge::sn::TileTerrain2::TileTerrain2 ( )

Constructor.

kge::sn::TileTerrain2::~TileTerrain2 ( )

Destructor.

Member Function Documentation

void kge::sn::TileTerrain2::BrushTile ( float  x,
float  y,
int  tileid,
float  BlendFactor,
bool  ChangeBackground = false,
bool  Mode2 = false 
)

Brush the tiles.

void kge::sn::TileTerrain2::CreateDeferredShaderCode ( core::String VertexCode,
core::String PixelCode 
)

Creates the terrain shader code for deferred shading.

void kge::sn::TileTerrain2::CreateShaderCode ( core::String VertexCode,
core::String PixelCode 
)
virtual

Creates the terrain shader code.

Reimplemented from kge::sn::TileTerrain.

std::vector<TileTerrain2::MapIDData> kge::sn::TileTerrain2::GetBlendMapIDs ( float  x,
float  y 
)
protected
const u8* kge::sn::TileTerrain2::GetBlendMapsData ( int  n) const
int kge::sn::TileTerrain2::GetMapsCount ( ) const
inline

Definition at line 69 of file TileTerrain2.h.

const u8* kge::sn::TileTerrain2::GetTextureIDMapsData ( int  n) const
void kge::sn::TileTerrain2::ReCreate ( int  numCols,
int  numRows,
float  MinHeight = 0.0f,
float  MaxHeight = 0.0f 
)
virtual

Create the terrain if already created then recreate it.

Reimplemented from kge::sn::TileTerrain.

void kge::sn::TileTerrain2::Render ( )
virtual

Render the terrain.

Reimplemented from kge::sn::TileTerrain.

void kge::sn::TileTerrain2::SetBlendMapsData ( int  n,
u8 data,
int  size 
)
void kge::sn::TileTerrain2::SetBrush ( char *  FileName)

Sets the brush texture and shape.

void kge::sn::TileTerrain2::SetBrushShaderParams ( gfx::ShaderInstance pSI)
protected
void kge::sn::TileTerrain2::SetBrushSize ( float  fSize)

Sets the brush size.

void kge::sn::TileTerrain2::SetTextureIDMapsData ( int  n,
u8 data,
int  size 
)
void kge::sn::TileTerrain2::SetTile ( int  Col,
int  Row,
u32  TileID 
)
virtual

Sets the tile in the terrain.

Reimplemented from kge::sn::TileTerrain.

void kge::sn::TileTerrain2::SetTileTexture ( gfx::Texture pTileTex,
int  Width,
int  Height,
int  HorizantalTilesCount,
int  VerticalTilesCount,
int  TileSizeInPixel 
)

Sets the tile texture.

void kge::sn::TileTerrain2::userSetShaderParams ( )
protectedvirtual

Reimplemented from kge::sn::TileTerrain.

Member Data Documentation

float kge::sn::TileTerrain2::m_fBrushSize
protected

Definition at line 106 of file TileTerrain2.h.

float kge::sn::TileTerrain2::m_fHTilesCountInverse
protected

Definition at line 91 of file TileTerrain2.h.

float kge::sn::TileTerrain2::m_fVTilesCountInverse
protected

Definition at line 91 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iBitCount
protected

Definition at line 82 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iMapsCount
protected

counts

Definition at line 82 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iMapsCX
protected

Definition at line 82 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iMapsCY
protected

Definition at line 82 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iMapsSize
protected

Definition at line 82 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iTileH
protected

Definition at line 82 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iTileSizeInPixel
protected

Definition at line 82 of file TileTerrain2.h.

int kge::sn::TileTerrain2::m_iTileW
protected

Definition at line 82 of file TileTerrain2.h.

kge::math::Matrix kge::sn::TileTerrain2::m_m2D
protected

Definition at line 108 of file TileTerrain2.h.

gfx::Texture* kge::sn::TileTerrain2::m_pBrush
protected

Definition at line 95 of file TileTerrain2.h.

gfx::Image* kge::sn::TileTerrain2::m_pImgBrush
protected

Definition at line 97 of file TileTerrain2.h.

gfx::Image * kge::sn::TileTerrain2::m_pImgScaledBrush
protected

Definition at line 97 of file TileTerrain2.h.

gfx::Texture** kge::sn::TileTerrain2::m_ppBlendMaps
protected

Blend maps.

Definition at line 78 of file TileTerrain2.h.

gfx::Shader * kge::sn::TileTerrain2::m_pPsBrush
protected

Definition at line 100 of file TileTerrain2.h.

gfx::Texture ** kge::sn::TileTerrain2::m_ppTextureIDMaps
protected

Definition at line 78 of file TileTerrain2.h.

gfx::Shader* kge::sn::TileTerrain2::m_pVsBrush
protected

Definition at line 100 of file TileTerrain2.h.

gfx::ShaderHandle kge::sn::TileTerrain2::m_shBrushBlend
protected

Definition at line 103 of file TileTerrain2.h.

gfx::ShaderHandle kge::sn::TileTerrain2::m_shDirLightColor
protected

Definition at line 103 of file TileTerrain2.h.


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