TerrainBlock Class Reference#include <terrData.h>
Inheritance diagram for TerrainBlock:
[legend]
|
Public Types |
enum | {
BlockSize = 256,
BlockShift = 8,
LightmapSize = 512,
LightmapShift = 9,
ChunkSquareWidth = 64,
ChunkSize = 4,
ChunkDownShift = 2,
ChunkShift = BlockShift - ChunkDownShift,
BlockSquareWidth = 256,
SquareMaxPoints = 1024,
BlockMask = 255,
GridMapSize = 0x15555,
FlagMapWidth = 128,
FlagMapMask = 127,
MaxMipLevel = 6,
NumBaseTextures = 16,
MaterialGroups = 8,
MaxEmptyRunPairs = 100
} |
enum | UpdateMaskBits {
InitMask = 1,
VisibilityMask = 2,
EmptyMask = 4
} |
Public Member Functions |
void | triggerLightmapReload () |
void | processTextureEvent (const U32 eventCode) |
| TerrainBlock () |
| ~TerrainBlock () |
void | buildChunkDeviance (S32 x, S32 y) |
void | buildGridMap () |
U32 | getCRC () |
Resource< TerrainFile > | getFile () |
bool | onAdd () |
| Called when the object is added to the sim.
|
void | onRemove () |
| Called when the object is removed from the sim.
|
void | refreshMaterialLists () |
void | onEditorEnable () |
| Called when the editor is activated.
|
void | onEditorDisable () |
| Called when the editor is deactivated.
|
void | rebuildEmptyFlags () |
bool | unpackEmptySquares () |
void | packEmptySquares () |
TextureHandle | getDetailTextureHandle () |
TextureHandle | getBumpTextureHandle () |
TextureHandle | getInvertedBumpTextureHandle () |
Material * | getMaterial (U32 x, U32 y) |
GridSquare * | findSquare (U32 level, Point2I pos) |
GridSquare * | findSquare (U32 level, S32 x, S32 y) |
GridChunk * | findChunk (Point2I pos) |
void | setHeight (const Point2I &pos, float height) |
void | updateGrid (Point2I min, Point2I max) |
void | updateGridMaterials (Point2I min, Point2I max) |
U16 | getHeight (U32 x, U32 y) |
U16 * | getHeightAddress (U32 x, U32 y) |
void | setBaseMaterial (U32 x, U32 y, U8 matGroup) |
S32 | getTerrainMapIndex (Point3F &pt) |
U8 * | getMaterialAlphaMap (U32 matIndex) |
U8 * | getBaseMaterialAddress (U32 x, U32 y) |
U8 | getBaseMaterial (U32 x, U32 y) |
U16 * | getFlagMapPtr (S32 x, S32 y) |
void | getMaterialAlpha (Point2I pos, U8 alphas[MaterialGroups]) |
void | setMaterialAlpha (Point2I pos, const U8 alphas[MaterialGroups]) |
bool | getHeight (const Point2F &pos, F32 *height) |
bool | getNormal (const Point2F &pos, Point3F *normal, bool normalize=true) |
bool | getNormalAndHeight (const Point2F &pos, Point3F *normal, F32 *height, bool normalize=true) |
bool | collideBox (const Point3F &start, const Point3F &end, RayInfo *info) |
S32 | getMaterialAlphaIndex (const char *materialName) |
void | setFile (Resource< TerrainFile > file) |
bool | save (const char *filename) |
void | relight (const ColorF &lightColor, const ColorF &ambient, const Point3F &lightDir) |
S32 | getSquareSize () |
void | buildConvex (const Box3F &box, Convex *convex) |
| Builds a convex hull for this object.
|
bool | buildPolyList (AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere) |
| Builds a list of polygons which intersect a bounding volume.
|
BSPNode * | buildCollisionBSP (BSPTree *tree, const Box3F &box, const SphereF &sphere) |
| Builds a collision tree of all the polygons which collide with a bounding volume.
|
bool | castRay (const Point3F &start, const Point3F &end, RayInfo *info) |
| Casts a ray and obtain collision information, returns true if RayInfo is modified.
|
bool | castRayI (const Point3F &start, const Point3F &end, RayInfo *info, bool emptyCollide) |
bool | castRayBlock (const Point3F &pStart, const Point3F &pEnd, const Point2I &blockPos, U32 level, F32 invDeltaX, F32 invDeltaY, F32 startT, F32 endT, RayInfo *info, bool) |
bool | buildMaterialMap () |
void | buildMipMap () |
void | setBaseMaterials (S32 argc, const char *argv[]) |
bool | initMMXBlender () |
| DECLARE_CONOBJECT (TerrainBlock) |
void | inspectPostApply () |
| Called after any property of the object is changed in the world editor.
|
U32 | packUpdate (NetConnection *conn, U32 mask, BitStream *stream) |
| Instructs this object to pack its state for transfer over the network.
|
void | unpackUpdate (NetConnection *conn, BitStream *stream) |
| Instructs this object to read state data previously packed with packUpdate.
|
Static Public Member Functions |
static void | flushCache () |
static void | initPersistFields () |
| Register dynamic fields in a subclass of ConsoleObject.
|
Data Fields |
Blender * | mBlender |
TextureHandle | baseTextures [NumBaseTextures] |
TextureHandle | mBaseMaterials [MaterialGroups] |
TextureHandle | mAlphaMaterials [MaterialGroups] |
GBitmap * | lightMap |
GBitmap * | whiteMap |
TextureHandle | lightMapTexture |
StringTableEntry * | mMaterialFileName |
| Array from the file.
|
TextureHandle | mDynLightTexture |
U8 * | mBaseMaterialMap |
Material * | materialMap |
U16 * | heightMap |
U16 * | flagMap |
StringTableEntry | mDetailTextureName |
TextureHandle | mDetailTextureHandle |
StringTableEntry | mBumpTextureName |
TextureHandle | mBumpTextureHandle |
TextureHandle | mInvertedBumpTextureHandle |
F32 | mBumpScale |
F32 | mBumpOffset |
U32 | mZeroBumpScale |
StringTableEntry | mTerrFileName |
Vector< S32 > | mEmptySquareRuns |
U32 | mTextureCallbackKey |
S32 | mMPMIndex [TerrainBlock::MaterialGroups] |
S32 | mVertexBuffer |
bool | mTile |
| If true, we tile infinitely.
|
Protected Member Functions |
void | setTransform (const MatrixF &mat) |
| Sets the Object -> World transform.
|
bool | prepRenderImage (SceneState *state, const U32 stateKey, const U32 startZone, const bool modifyBaseZoneState=false) |
| Called when the SceneGraph is ready for the registration of RenderImages.
|
void | renderObject (SceneState *state, SceneRenderImage *image) |
| Called when the object is supposed to render itself.
|
Private Types |
typedef SceneObject | Parent |
Private Member Functions |
BSPNode * | buildSquareTree (S32 y, S32 x) |
BSPNode * | buildXTree (S32 y, S32 xStart, S32 xEnd) |
Private Attributes |
Resource< TerrainFile > | mFile |
GridSquare * | gridMap [BlockShift+1] |
GridChunk * | mChunkMap |
U32 | mCRC |
S32 | squareSize |
BSPTree * | mTree |
S32 | mHeightMin |
S32 | mHeightMax |
bool | mCollideEmpty |
Data Structures |
struct | Material |
Member Typedef Documentation
Member Enumeration Documentation
- Enumerator:
-
BlockSize |
|
BlockShift |
|
LightmapSize |
|
LightmapShift |
|
ChunkSquareWidth |
|
ChunkSize |
|
ChunkDownShift |
|
ChunkShift |
|
BlockSquareWidth |
|
SquareMaxPoints |
|
BlockMask |
|
GridMapSize |
|
FlagMapWidth |
Flags that map is for 2x2 squares. |
FlagMapMask |
|
MaxMipLevel |
|
NumBaseTextures |
|
MaterialGroups |
|
MaxEmptyRunPairs |
|
- Enumerator:
-
InitMask |
|
VisibilityMask |
|
EmptyMask |
|
Constructor & Destructor Documentation
TerrainBlock::TerrainBlock |
( |
|
) |
|
TerrainBlock::~TerrainBlock |
( |
|
) |
|
Member Function Documentation
void TerrainBlock::triggerLightmapReload |
( |
|
) |
[inline] |
void TerrainBlock::processTextureEvent |
( |
const U32 |
eventCode |
) |
|
void TerrainBlock::buildChunkDeviance |
( |
S32 |
x, |
|
|
S32 |
y | |
|
) |
| | |
void TerrainBlock::buildGridMap |
( |
|
) |
|
U32 TerrainBlock::getCRC |
( |
|
) |
[inline] |
bool TerrainBlock::onAdd |
( |
|
) |
[virtual] |
Called when the object is added to the sim.
Reimplemented from SceneObject.
void TerrainBlock::onRemove |
( |
|
) |
[virtual] |
Called when the object is removed from the sim.
Reimplemented from SceneObject.
void TerrainBlock::refreshMaterialLists |
( |
|
) |
|
void TerrainBlock::onEditorEnable |
( |
|
) |
[virtual] |
Called when the editor is activated.
Reimplemented from SimObject.
void TerrainBlock::onEditorDisable |
( |
|
) |
[virtual] |
Called when the editor is deactivated.
Reimplemented from SimObject.
void TerrainBlock::rebuildEmptyFlags |
( |
|
) |
|
bool TerrainBlock::unpackEmptySquares |
( |
|
) |
|
void TerrainBlock::packEmptySquares |
( |
|
) |
|
TextureHandle TerrainBlock::getDetailTextureHandle |
( |
|
) |
[inline] |
TextureHandle TerrainBlock::getBumpTextureHandle |
( |
|
) |
|
TextureHandle TerrainBlock::getInvertedBumpTextureHandle |
( |
|
) |
|
void TerrainBlock::setHeight |
( |
const Point2I & |
pos, |
|
|
float |
height | |
|
) |
| | |
U16 TerrainBlock::getHeight |
( |
U32 |
x, |
|
|
U32 |
y | |
|
) |
| | [inline] |
U16* TerrainBlock::getHeightAddress |
( |
U32 |
x, |
|
|
U32 |
y | |
|
) |
| | [inline] |
void TerrainBlock::setBaseMaterial |
( |
U32 |
x, |
|
|
U32 |
y, |
|
|
U8 |
matGroup | |
|
) |
| | |
S32 TerrainBlock::getTerrainMapIndex |
( |
Point3F & |
pt |
) |
|
U8 * TerrainBlock::getMaterialAlphaMap |
( |
U32 |
matIndex |
) |
[inline] |
U8 * TerrainBlock::getBaseMaterialAddress |
( |
U32 |
x, |
|
|
U32 |
y | |
|
) |
| | [inline] |
U8 TerrainBlock::getBaseMaterial |
( |
U32 |
x, |
|
|
U32 |
y | |
|
) |
| | [inline] |
U16 * TerrainBlock::getFlagMapPtr |
( |
S32 |
x, |
|
|
S32 |
y | |
|
) |
| | [inline] |
void TerrainBlock::getMaterialAlpha |
( |
Point2I |
pos, |
|
|
U8 |
alphas[MaterialGroups] | |
|
) |
| | |
void TerrainBlock::setMaterialAlpha |
( |
Point2I |
pos, |
|
|
const U8 |
alphas[MaterialGroups] | |
|
) |
| | |
bool TerrainBlock::getHeight |
( |
const Point2F & |
pos, |
|
|
F32 * |
height | |
|
) |
| | |
bool TerrainBlock::getNormal |
( |
const Point2F & |
pos, |
|
|
Point3F * |
normal, |
|
|
bool |
normalize = true | |
|
) |
| | |
bool TerrainBlock::getNormalAndHeight |
( |
const Point2F & |
pos, |
|
|
Point3F * |
normal, |
|
|
F32 * |
height, |
|
|
bool |
normalize = true | |
|
) |
| | |
bool TerrainBlock::collideBox |
( |
const Point3F & |
start, |
|
|
const Point3F & |
end, |
|
|
RayInfo * |
info | |
|
) |
| | [inline, virtual] |
S32 TerrainBlock::getMaterialAlphaIndex |
( |
const char * |
materialName |
) |
|
bool TerrainBlock::save |
( |
const char * |
filename |
) |
|
static void TerrainBlock::flushCache |
( |
|
) |
[static] |
S32 TerrainBlock::getSquareSize |
( |
|
) |
[inline] |
void TerrainBlock::setTransform |
( |
const MatrixF & |
mat |
) |
[protected, virtual] |
Sets the Object -> World transform.
- Parameters:
-
Reimplemented from SceneObject.
bool TerrainBlock::prepRenderImage |
( |
SceneState * |
state, |
|
|
const U32 |
stateKey, |
|
|
const U32 |
startZone, |
|
|
const bool |
modifyBaseZoneState = false | |
|
) |
| | [protected, virtual] |
Called when the SceneGraph is ready for the registration of RenderImages.
- See also:
- SceneState
- Parameters:
-
| state | SceneState |
| stateKey | State key of the current SceneState |
| startZone | Base zone index |
| modifyBaseZoneState | If true, the object needs to modify the zone state. |
Reimplemented from SceneObject.
Called when the object is supposed to render itself.
- Parameters:
-
| state | Current rendering state. |
- See also:
- SceneState
- Parameters:
-
| image | Image associated with this object to render. |
- See also:
- SceneRenderImage
Reimplemented from SceneObject.
void TerrainBlock::buildConvex |
( |
const Box3F & |
box, |
|
|
Convex * |
convex | |
|
) |
| | [virtual] |
Builds a convex hull for this object.
Think of a convex hull as a low-res mesh which covers, as tightly as possible, the object mesh, and is used as a collision mesh. - Parameters:
-
| box | |
| convex | Convex mesh generated (out) |
Reimplemented from SceneObject.
Builds a list of polygons which intersect a bounding volume.
This will use either the sphere or the box, not both, the SceneObject implimentation ignores sphere.
- See also:
- AbstractPolyList
- Parameters:
-
| polyList | Poly list build (out) |
| box | Box bounding volume |
| sphere | Sphere bounding volume |
Reimplemented from SceneObject.
Casts a ray and obtain collision information, returns true if RayInfo is modified.
- Parameters:
-
| start | Start point of ray |
| end | End point of ray |
| info | Collision information obtained (out) |
Reimplemented from SceneObject.
bool TerrainBlock::castRayI |
( |
const Point3F & |
start, |
|
|
const Point3F & |
end, |
|
|
RayInfo * |
info, |
|
|
bool |
emptyCollide | |
|
) |
| | |
BSPNode* TerrainBlock::buildSquareTree |
( |
S32 |
y, |
|
|
S32 |
x | |
|
) |
| | [private] |
bool TerrainBlock::buildMaterialMap |
( |
|
) |
|
void TerrainBlock::buildMipMap |
( |
|
) |
|
void TerrainBlock::setBaseMaterials |
( |
S32 |
argc, |
|
|
const char * |
argv[] | |
|
) |
| | |
bool TerrainBlock::initMMXBlender |
( |
|
) |
|
static void TerrainBlock::initPersistFields |
( |
|
) |
[static] |
void TerrainBlock::inspectPostApply |
( |
|
) |
[virtual] |
Instructs this object to pack its state for transfer over the network.
- Parameters:
-
| conn | Net connection being used |
| mask | Mask indicating fields to transmit. |
| stream | Bitstream to pack data to |
- Returns:
- Any bits which were not dealt with. The value is stored by the networking system. Don't set bits you weren't passed.
Reimplemented from NetObject.
Instructs this object to read state data previously packed with packUpdate.
- Parameters:
-
| conn | Net connection being used |
| stream | stream to read from |
Reimplemented from NetObject.
Field Documentation
If true, we tile infinitely.
|