|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CVisualCollisionEntity Class ReferenceAn entity created by CVisualCollisionManager.
More...
#include <visual_collision_entity.h>
List of all members.
Landscape part. |
bool | triangleIntersect2DGround (CTriangle &tri, const CVector &pos0) |
| Fast "2D" test of a triangle against ray P0 P1. More...
|
bool | triangleIntersect2DCeil (CTriangle &tri, const CVector &pos0) |
bool | triangleIntersect (CTriangle &tri, const CVector &pos0, const CVector &pos1, CVector &hit) |
| Fast "2D" test of a triangle against ray P0 P1. More...
|
void | testComputeLandscape (const CVector &pos) |
| test if the new position is outside the preceding setuped bbox, and then compute tiles infos around the position. More...
|
void | doComputeLandscape (const CVector &pos) |
| compute tiles infos around the position. More...
|
void | snapToLandscapeCurrentTesselation (CVector &pos, const CTrianglePatch &tri) |
| snap to current rendered tesselation. More...
|
CTrianglePatch * | getPatchTriangleUnderUs (const CVector &pos, CVector &res) |
| return the best trianglePatch under what we are. More...
|
std::vector< CPatchQuadBlock * > | _PatchQuadBlocks |
| Array of quadBlock which are around the entity. More...
|
CLandscapeCollisionGrid | _LandscapeQuadGrid |
| A quadgrid of chainlist of tileId (CVisualTileDescNode), which are around the entity. More...
|
CAABBox | _CurrentBBoxValidity |
| The current BBox where we don't need to recompute the patchQuadBlocks if the entity is in. More...
|
bool | _LastGPTValid |
| Cache for getPatchTriangleUnderUs(). More...
|
CVector | _LastGPTPosInput |
CVector | _LastGPTPosOutput |
CTrianglePatch | _LastGPTTrianglePatch |
void | computeUvForPos (const CTrianglePatch &tri, const CVector &pos, CUV &uv) |
| given a CTrianglePatch, compute Patch uv according to position. More...
|
const uint32 | _StartPatchQuadBlockSize = 64 |
| Default capacity of _PatchQuadBlocks. More...
|
std::vector< CPatchBlockIdent > | _TmpBlockIds |
| This is the temp array of BlockIds filled by landscape search. More...
|
std::vector< CPatchQuadBlock * > | _TmpPatchQuadBlocks |
| This is the temp array of PatchBlocks ptr. More...
|
Public Methods |
| CVisualCollisionEntity (CVisualCollisionManager *owner) |
| Constructor. More...
|
| ~CVisualCollisionEntity () |
bool | snapToGround (CVector &pos) |
| Snap the entity onto the ground. More...
|
bool | snapToGround (CVector &pos, CVector &normal) |
| Snap the entity onto the ground. More...
|
void | setGroundMode (bool groundMode) |
| If groundMode is true, the entity is snapped on faces with normal.z > 0. More...
|
void | setCeilMode (bool ceilMode) |
| If ceilMode is true, the entity is snapped on faces with normal.z < 0. More...
|
bool | getGroundMode () const |
bool | getCeilMode () const |
void | setSnapToRenderedTesselation (bool snapMode) |
| By default, the visual collision entity is snapped on rendered/geomorphed tesselation (true). More...
|
bool | getSnapToRenderedTesselation () const |
bool | getSurfaceInfo (const CVector &pos, CSurfaceInfo &info) |
| Get surface informations. More...
|
|
bool | getStaticLightSetup (const CVector &pos, std::vector< CPointLightInfluence > &pointLightList, uint8 &sunContribution, NLMISC::CRGBA &localAmbient) |
| Get the static Light Setup, using landscape under us. More...
|
|
void | displayDebugGrid (IDriver &drv) const |
| Draw lines for the landscape quadgrid collision faces under us. More...
|
Static Public Attributes |
|
const float | BBoxRadius = 10 |
| This is the radius of the bbox around the entity where we have correct collisions: 10m. More...
|
const float | BBoxRadiusZ = 20 |
| Same as BBoxRadius, but for z value. More...
|
Private Attributes |
CVisualCollisionManager * | _Owner |
bool | _CeilMode |
bool | _GroundMode |
bool | _SnapToRenderedTesselation |
Detailed Description
An entity created by CVisualCollisionManager.
-
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2001
Definition at line 50 of file visual_collision_entity.h.
Constructor & Destructor Documentation
NL3D::CVisualCollisionEntity::~CVisualCollisionEntity |
( |
|
) |
|
|
Member Function Documentation
void NL3D::CVisualCollisionEntity::computeUvForPos |
( |
const CTrianglePatch & |
tri, |
|
|
const CVector & |
pos, |
|
|
CUV & |
uv |
|
) |
[static, private] |
|
void NL3D::CVisualCollisionEntity::displayDebugGrid |
( |
IDriver & |
drv |
) |
const |
|
void NL3D::CVisualCollisionEntity::doComputeLandscape |
( |
const CVector & |
pos |
) |
[private] |
|
bool NL3D::CVisualCollisionEntity::getCeilMode |
( |
|
) |
const [inline] |
|
bool NL3D::CVisualCollisionEntity::getGroundMode |
( |
|
) |
const [inline] |
|
CTrianglePatch * NL3D::CVisualCollisionEntity::getPatchTriangleUnderUs |
( |
const CVector & |
pos, |
|
|
CVector & |
res |
|
) |
[private] |
|
|
return the best trianglePatch under what we are.
NULL if not found. Ptr is valid until next call to getPatchTriangleUnderUs() Actually return NULL or &_LastTrianglePatch;
Definition at line 95 of file visual_collision_entity.cpp.
References _LandscapeQuadGrid, _LastGPTPosInput, _LastGPTPosOutput, _LastGPTTrianglePatch, _LastGPTValid, _Owner, _PatchQuadBlocks, nlassert, res, NLMISC::sqr, testComputeLandscape, and triangleIntersect.
Referenced by getStaticLightSetup, getSurfaceInfo, and snapToGround. |
bool NL3D::CVisualCollisionEntity::getSnapToRenderedTesselation |
( |
|
) |
const [inline] |
|
|
Get the static Light Setup, using landscape under us.
append lights to pointLightList. NB: if find no landscape faces, don't modify pointLightList, set sunContribution=255, and return false Else, use CPatch::TileLightInfluences to get lights, and use CPatch::Lumels to get sunContribution. NB: because CPatch::Lumels encode the gouraud shading on the surface, returning lumelValue will darken the object too much. To avoid this, the sunContribution is raised to a power (0..1). See CVisualCollisionManager::setSunContributionPower(). Default is 0.5
Definition at line 516 of file visual_collision_entity.cpp.
References _Owner, computeUvForPos, getPatchTriangleUnderUs, res, and NLMISC::CRGBA::set. |
bool NL3D::CVisualCollisionEntity::getSurfaceInfo |
( |
const CVector & |
pos, |
|
|
CSurfaceInfo & |
info |
|
) |
|
|
void NL3D::CVisualCollisionEntity::setCeilMode |
( |
bool |
ceilMode |
) |
[inline] |
|
|
If ceilMode is true, the entity is snapped on faces with normal.z < 0.
Default is false. NB: if both groundMode and ceilMode are false, snapToGround is a no-op.
Definition at line 86 of file visual_collision_entity.h.
References _CeilMode. |
void NL3D::CVisualCollisionEntity::setGroundMode |
( |
bool |
groundMode |
) |
[inline] |
|
|
If groundMode is true, the entity is snapped on faces with normal.z > 0.
Default is true. NB: if both groundMode and ceilMode are false, snapToGround is a no-op.
Definition at line 80 of file visual_collision_entity.h.
References _GroundMode. |
void NL3D::CVisualCollisionEntity::setSnapToRenderedTesselation |
( |
bool |
snapMode |
) |
[inline] |
|
|
By default, the visual collision entity is snapped on rendered/geomorphed tesselation (true).
Use this method to change this behavior. if false, the entity is snapped to the tile level tesselation according to noise etc...
Definition at line 97 of file visual_collision_entity.h.
References _SnapToRenderedTesselation. |
bool NL3D::CVisualCollisionEntity::snapToGround |
( |
CVector & |
pos, |
|
|
CVector & |
normal |
|
) |
|
|
|
Snap the entity onto the ground.
pos.z is modified so that it lies on the ground, according to rendered landscapes and meshes. pos is checked with polygons that are at least (cache dependent) at +- 10m in altitude. -
Parameters:
-
normal |
the ret normal of where it is snapped. NB: if return false, not modified. |
-
Returns:
-
true if pos.z has been modified (sometimes it may not find a solution).
Definition at line 204 of file visual_collision_entity.cpp.
References getPatchTriangleUnderUs, res, and snapToLandscapeCurrentTesselation. |
bool NL3D::CVisualCollisionEntity::snapToGround |
( |
CVector & |
pos |
) |
|
|
|
Snap the entity onto the ground.
pos.z is modified so that it lies on the ground, according to rendered landscapes and meshes. see setSnapToRenderedTesselation() option. pos is checked with polygons that are at least (cache dependent) at +- 10m in altitude. -
Returns:
-
true if pos.z has been modified (sometimes it may not find a solution).
Definition at line 86 of file visual_collision_entity.cpp. |
void NL3D::CVisualCollisionEntity::snapToLandscapeCurrentTesselation |
( |
CVector & |
pos, |
|
|
const CTrianglePatch & |
tri |
|
) |
[private] |
|
void NL3D::CVisualCollisionEntity::testComputeLandscape |
( |
const CVector & |
pos |
) |
[private] |
|
bool NL3D::CVisualCollisionEntity::triangleIntersect |
( |
CTriangle & |
tri, |
|
|
const CVector & |
pos0, |
|
|
const CVector & |
pos1, |
|
|
CVector & |
hit |
|
) |
[private] |
|
bool NL3D::CVisualCollisionEntity::triangleIntersect2DCeil |
( |
CTriangle & |
tri, |
|
|
const CVector & |
pos0 |
|
) |
[private] |
|
bool NL3D::CVisualCollisionEntity::triangleIntersect2DGround |
( |
CTriangle & |
tri, |
|
|
const CVector & |
pos0 |
|
) |
[private] |
|
Member Data Documentation
bool NL3D::CVisualCollisionEntity::_CeilMode [private]
|
|
CAABBox NL3D::CVisualCollisionEntity::_CurrentBBoxValidity [private]
|
|
bool NL3D::CVisualCollisionEntity::_GroundMode [private]
|
|
CVector NL3D::CVisualCollisionEntity::_LastGPTPosInput [private]
|
|
CVector NL3D::CVisualCollisionEntity::_LastGPTPosOutput [private]
|
|
CTrianglePatch NL3D::CVisualCollisionEntity::_LastGPTTrianglePatch [private]
|
|
bool NL3D::CVisualCollisionEntity::_LastGPTValid [private]
|
|
std::vector<CPatchQuadBlock*> NL3D::CVisualCollisionEntity::_PatchQuadBlocks [private]
|
|
bool NL3D::CVisualCollisionEntity::_SnapToRenderedTesselation [private]
|
|
const uint32 NL3D::CVisualCollisionEntity::_StartPatchQuadBlockSize = 64 [static, private]
|
|
vector< CPatchBlockIdent > NL3D::CVisualCollisionEntity::_TmpBlockIds [static, private]
|
|
vector< CPatchQuadBlock * > NL3D::CVisualCollisionEntity::_TmpPatchQuadBlocks [static, private]
|
|
const float NL3D::CVisualCollisionEntity::BBoxRadius = 10 [static]
|
|
const float NL3D::CVisualCollisionEntity::BBoxRadiusZ = 20 [static]
|
|
|
Same as BBoxRadius, but for z value.
This later should be greater because of NLPACS surface quadtree imprecision. 20m NB: Because of caching, if the pos.z passed to snapToGround() is outside of the currentBBox with BBoxRadiuZ/2 (=> 10m), then the bbox is recomputed. Hence, this actually means that a pos is checked with patchs that are at least at +- 10m in altitude.
Definition at line 48 of file visual_collision_entity.cpp.
Referenced by doComputeLandscape. |
The documentation for this class was generated from the following files:
|
|