Support Forum G3D Web Page |
Piece of 3D geometry that tracks its own 2D projection.
More...
Public Member Functions | |
UIGeom () | |
void | computeProjection (RenderDevice *rd) |
Computes the 2D positions from the 3D ones using the renderDevice and updates the zOrder. More... | |
bool | contains (const Vector2 &p, float &nearestDepth, Vector2 &tangent2D, float &projectionW, float lineRadius=9) const |
Returns true and sets nearestDepth (on the range 0 = close, 1 = far) if p is in a polygon (or within lineRadius of the nearest line) and the depth of that object is less than nearestDepth, otherwise returns false. More... | |
void | render (RenderDevice *rd, const Color3 &color, float lineScale=1.0f) const |
Render in 3D using the current blending mode, etc. More... | |
Public Attributes | |
Array< PolyLine2D > | line2D |
Recomputed from 3D in the computeProjection method. More... | |
Array< PolyLine > | line3D |
Relative to the "current" object to world matrix. More... | |
Array< Array< float > > | lineDepth |
Array< Array< float > > | lineW |
Array< ConvexPolygon2D > | poly2D |
Recomputed from 3D in the computeProjection method. More... | |
Array< ConvexPolygon > | poly3D |
Relative to the "current" object to world matrix. More... | |
Array< bool > | polyBackfacing |
If last time we rendered the poly3D was backwards. More... | |
Array< float > | polyDepth |
bool | visible |
Static Protected Member Functions | |
static Vector3 | computeEye (RenderDevice *rd) |
Returns the object space eye point. More... | |
static Vector3 | segmentNormal (const LineSegment &seg, const Vector3 &eye) |
Returns the normal to a line segment. More... | |
Protected Attributes | |
bool | m_twoSidedPolys |
If true, backface polygons are tested for mouse clicks. More... | |
Piece of 3D geometry that tracks its own 2D projection.
For use in building 3D clickable widgets using only 2D code.
The 2D approach allows the click width around a line to be constant width; it also allows the use of arbitrary projection matrices. However, it has problems at the near plane unlike a ray-cast 3D approach.
|
inline |
|
staticprotected |
Returns the object space eye point.
void G3D::_internal::UIGeom::computeProjection | ( | RenderDevice * | rd | ) |
Computes the 2D positions from the 3D ones using the renderDevice and updates the zOrder.
bool G3D::_internal::UIGeom::contains | ( | const Vector2 & | p, |
float & | nearestDepth, | ||
Vector2 & | tangent2D, | ||
float & | projectionW, | ||
float | lineRadius = 9 |
||
) | const |
Returns true and sets nearestDepth (on the range 0 = close, 1 = far) if p is in a polygon (or within lineRadius of the nearest line) and the depth of that object is less than nearestDepth, otherwise returns false.
depth values are approximate.
tangent2D | Returns the projected tangent (unit length 3D vector projected into 2D, which then has non-unit length) to the selected location if it was a line; undefined if it was a plane. |
projectionW | Returns the if close to a line. |
void G3D::_internal::UIGeom::render | ( | RenderDevice * | rd, |
const Color3 & | color, | ||
float | lineScale = 1.0f |
||
) | const |
Render in 3D using the current blending mode, etc.
Line normals are set to face towards the camera, perpendicular to the line.
|
staticprotected |
Returns the normal to a line segment.
Array<PolyLine2D> G3D::_internal::UIGeom::line2D |
Recomputed from 3D in the computeProjection method.
|
protected |
If true, backface polygons are tested for mouse clicks.
Array<ConvexPolygon2D> G3D::_internal::UIGeom::poly2D |
Recomputed from 3D in the computeProjection method.
Array<ConvexPolygon> G3D::_internal::UIGeom::poly3D |
Relative to the "current" object to world matrix.
Array<bool> G3D::_internal::UIGeom::polyBackfacing |
If last time we rendered the poly3D was backwards.
Array< float > G3D::_internal::UIGeom::polyDepth |
bool G3D::_internal::UIGeom::visible |