Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <quadsquare.h>
Public Member Functions | |
quadsquare (quadcornerdata *pcd) | |
~quadsquare () | |
void | AddHeightMap (const quadcornerdata &cd, const HeightMapInfo &hm) |
Createsa lookup table for the terrain texture. More... | |
void | AddHeightMapAux (const quadcornerdata &cd, const HeightMapInfo &hm) |
void | StaticCullData (const quadcornerdata &cd, float ThresholdDetail) |
float | RecomputeErrorAndLighting (const quadcornerdata &cd) |
int | CountNodes () const |
void | Update (const quadcornerdata &cd, const Vector &ViewerLocation, float Detail, unsigned short numstages, unsigned short whichstage, updateparity *whichordertoupdate) |
Make sure to translate into Quadtree Space. More... | |
int | Render (const quadcornerdata &cd, const Vector &camera) |
float | GetHeight (const quadcornerdata &cd, float x, float z, Vector &normal) |
Static Public Member Functions | |
static Vector | MakeLightness (float xslope, float zslope, const Vector &loc) |
static void | SetCurrentTerrain (unsigned int *VertexAllocated, unsigned int *VertexCount, GFXVertexList *vertices, std::vector< unsigned int > *unusedvertices, IdentityTransform *transform, std::vector< TerrainTexture > *texturelist, const Vector &NormalScale, quadsquare *neighbor[4]) |
Public Attributes | |
quadsquare * | Child [4] |
VertInfo | Vertex [5] |
unsigned short | Error [6] |
unsigned short | MinY |
unsigned short | MaxY |
unsigned char | EnabledFlags |
unsigned char | SubEnabledCount [2] |
bool | Static |
bool | Dirty |
A node in the quad tree holds its own relevant vertex data (middle and either even or odd 4 sets of data (corners or diagonals Keeps track of its errors and children as well
Definition at line 113 of file quadsquare.h.
quadsquare::quadsquare | ( | quadcornerdata * | pcd) |
Definition at line 100 of file quadsquare.cpp.
References GFXVertexList::BeginMutate(), Child, EnabledFlags, GFXVertexList::EndMutate(), Error, InterpolateTextures(), MaxY, MinY, GFXVertex::SetNormal(), quadcornerdata::Square, Static, SubEnabledCount, Vertex, GFXVertexList::VDAT::vertices, VertInfo::vertindex, quadcornerdata::Verts, VertInfo::Y, y, and AiXml::Y.
Referenced by AddHeightMapAux().
quadsquare::~quadsquare | ( | ) |
Definition at line 166 of file quadsquare.cpp.
References Child, Vertex, and VertInfo::vertindex.
void quadsquare::AddHeightMap | ( | const quadcornerdata & | cd, |
const HeightMapInfo & | hm | ||
) |
Createsa lookup table for the terrain texture.
Definition at line 356 of file quadsquare.cpp.
References AddHeightMapAux().
void quadsquare::AddHeightMapAux | ( | const quadcornerdata & | cd, |
const HeightMapInfo & | hm | ||
) |
Definition at line 365 of file quadsquare.cpp.
References AddHeightMapAux(), GFXVertexList::BeginMutate(), Child, quadcornerdata::ChildIndex, Dirty, GFXVertexList::EndMutate(), int, quadcornerdata::Level, quadcornerdata::Parent, q, quadsquare(), HeightMapInfo::Sample(), HeightMapInfo::Scale, VertInfo::SetTex(), quadcornerdata::Square, Vertex, GFXVertexList::VDAT::vertices, quadcornerdata::xorg, HeightMapInfo::XOrigin, HeightMapInfo::XSize, VertInfo::Y, AiXml::Y, quadcornerdata::zorg, HeightMapInfo::ZOrigin, and HeightMapInfo::ZSize.
Referenced by AddHeightMap(), and AddHeightMapAux().
int quadsquare::CountNodes | ( | ) | const |
Definition at line 193 of file quadsquare.cpp.
References Child, and CountNodes().
Referenced by CountNodes().
float quadsquare::GetHeight | ( | const quadcornerdata & | cd, |
float | x, | ||
float | z, | ||
Vector & | normal | ||
) |
Returns the height of the heightfield at the specified x,z coordinates. Can be used for collision detection
iz = 1;
Definition at line 207 of file quadsquare.cpp.
References Child, GetHeight(), index, int, quadcornerdata::Level, q, Static, Vector, Vertex, quadcornerdata::Verts, quadcornerdata::xorg, VertInfo::Y, and quadcornerdata::zorg.
Referenced by QuadTree::GetGroundPos(), QuadTree::GetHeight(), and GetHeight().
Definition at line 379 of file quadsquare_update.cpp.
References QVector, IdentityTransform::TransformNormal(), and Vector.
Referenced by RecomputeErrorAndLighting().
float quadsquare::RecomputeErrorAndLighting | ( | const quadcornerdata & | cd) |
Recomputes the error values for this tree. Returns the max error. Also updates MinY & MaxY. Also computes quick & dirty vertex lighting for the demo.
Definition at line 392 of file quadsquare_update.cpp.
References GFXVertexList::BeginMutate(), Child, quadcornerdata::ChildIndex, Dirty, e, GFXVertexList::EndMutate(), Error, GFXVertex::GetConstVertex(), i, quadcornerdata::Level, MakeLightness(), MaxY, MinY, q, GFXVertex::SetNormal(), v, V, Vertex, GFXVertexList::VDAT::vertices, VertInfo::vertindex, quadcornerdata::Verts, VertInfo::Y, y, and AiXml::Y.
Referenced by StaticCullData().
int quadsquare::Render | ( | const quadcornerdata & | cd, |
const Vector & | camvec | ||
) |
Draws the heightfield represented by this tree Returns teh number of triangles rendered (not including multipass
Definition at line 40 of file quadsquare_render.cpp.
References AMBIENT, GFXVertexList::BeginDrawState(), GFXVertexList::BeginMutate(), GFXVertexList::VDAT::colors, DIFFUSE, GFXVertexList::Draw(), GFXVertexList::EndDrawState(), GFXVertexList::EndMutate(), GFX_PARTIALLY_VISIBLE, GFXColorMaterial(), GFXFALSE, GFXPolygonOffset(), GFXTRI, i, j, k, GFXVertexList::LoadDrawState(), TerrainMakeActive(), TerrainMakeClearActive(), and TerrainMakeDeactive().
Referenced by QuadTree::Render().
|
static |
Definition at line 325 of file quadsquare.cpp.
References GFXTRI.
Referenced by QuadTree::QuadTree(), QuadTree::Render(), and QuadTree::Update().
void quadsquare::StaticCullData | ( | const quadcornerdata & | cd, |
float | ThresholdDetail | ||
) |
Definition at line 21 of file quadsquare_cull.cpp.
References Dirty, BeamXML::level, and RecomputeErrorAndLighting().
Referenced by QuadTree::StaticCullData().
void quadsquare::Update | ( | const quadcornerdata & | cd, |
const Vector & | ViewerLocation, | ||
float | Detail, | ||
unsigned short | numstages, | ||
unsigned short | whichstage, | ||
updateparity * | par | ||
) |
Make sure to translate into Quadtree Space.
Refresh the vertex enabled states in the tree, according to the location of the viewer. May force creation or deletion of qsquares in areas which need to be interpolated.
Definition at line 266 of file quadsquare_update.cpp.
References calculatestage(), and transformstage().
Referenced by QuadTree::Update().
quadsquare* quadsquare::Child[4] |
Definition at line 116 of file quadsquare.h.
Referenced by AddHeightMapAux(), CountNodes(), GetHeight(), quadsquare(), RecomputeErrorAndLighting(), and ~quadsquare().
bool quadsquare::Dirty |
Definition at line 123 of file quadsquare.h.
Referenced by AddHeightMapAux(), RecomputeErrorAndLighting(), and StaticCullData().
unsigned char quadsquare::EnabledFlags |
Definition at line 120 of file quadsquare.h.
Referenced by quadsquare().
unsigned short quadsquare::Error[6] |
Definition at line 118 of file quadsquare.h.
Referenced by quadsquare(), and RecomputeErrorAndLighting().
unsigned short quadsquare::MaxY |
Definition at line 119 of file quadsquare.h.
Referenced by quadsquare(), and RecomputeErrorAndLighting().
unsigned short quadsquare::MinY |
Definition at line 119 of file quadsquare.h.
Referenced by quadsquare(), and RecomputeErrorAndLighting().
bool quadsquare::Static |
Definition at line 122 of file quadsquare.h.
Referenced by GetHeight(), and quadsquare().
unsigned char quadsquare::SubEnabledCount[2] |
Definition at line 121 of file quadsquare.h.
Referenced by quadsquare().
VertInfo quadsquare::Vertex[5] |
Definition at line 117 of file quadsquare.h.
Referenced by AddHeightMapAux(), GetHeight(), quadsquare(), RecomputeErrorAndLighting(), and ~quadsquare().