Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CHFTracer Class Reference

#include <HFTracer.h>

Collaboration diagram for CHFTracer:

Public Member Functions

 CHFTracer (CTerrain &terrain)
 
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_Terrain
 
const u16m_Heightfield
 
size_t m_MapSize
 
float m_CellSize
 
float m_HeightScale
 

Constructor & Destructor Documentation

◆ CHFTracer()

CHFTracer::CHFTracer ( CTerrain terrain)

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_Terrain

CTerrain& CHFTracer::m_Terrain
private

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