Pyrogenesis  trunk
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
CHFTracer Class Reference

#include <HFTracer.h>

Collaboration diagram for CHFTracer:
Collaboration graph
[legend]

Public Member Functions

 CHFTracer (CTerrain *pTerrain)
 
bool RayIntersect (const CVector3D &origin, const CVector3D &dir, int &x, int &z, CVector3D &ipt) const
 

Static Public Member Functions

static bool PatchRayIntersect (CPatch *patch, const CVector3D &origin, const CVector3D &dir, CVector3D *out)
 Intersects ray with a single patch. More...
 

Private Member Functions

bool CellIntersect (int cx, int cz, const CVector3D &origin, const CVector3D &dir, float &dist) const
 

Private Attributes

CTerrainm_pTerrain
 
const u16m_Heightfield
 
size_t m_MapSize
 
float m_CellSize
 
float m_HeightScale
 

Constructor & Destructor Documentation

◆ CHFTracer()

CHFTracer::CHFTracer ( CTerrain pTerrain)

Member Function Documentation

◆ CellIntersect()

bool CHFTracer::CellIntersect ( int  cx,
int  cz,
const CVector3D origin,
const CVector3D dir,
float &  dist 
) const
private

◆ PatchRayIntersect()

bool CHFTracer::PatchRayIntersect ( CPatch patch,
const CVector3D origin,
const CVector3D dir,
CVector3D out 
)
static

Intersects ray with a single patch.

The ray is a half-infinite line starting at origin with direction dir (not required to be a unit vector).. The patch is treated as a collection of two-sided triangles, corresponding to the terrain tiles.

If there is an intersection, returns true; and if out is not NULL, it is set to the intersection point. This is guaranteed to be the earliest tile intersected (starting at origin), but not necessarily the earlier triangle inside that tile.

This partly duplicates RayIntersect, but it only operates on a single patch, and it's more precise (it uses the same tile triangulation as the renderer), and tries to be more numerically robust.

◆ RayIntersect()

bool CHFTracer::RayIntersect ( const CVector3D origin,
const CVector3D dir,
int &  x,
int &  z,
CVector3D ipt 
) const

Member Data Documentation

◆ m_CellSize

float CHFTracer::m_CellSize
private

◆ m_Heightfield

const u16* CHFTracer::m_Heightfield
private

◆ m_HeightScale

float CHFTracer::m_HeightScale
private

◆ m_MapSize

size_t CHFTracer::m_MapSize
private

◆ m_pTerrain

CTerrain* CHFTracer::m_pTerrain
private

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