Support Forum       G3D Web Page     
Public Member Functions | Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
G3D::_internal::UIGeom Class Reference


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< PolyLine2Dline2D
 Recomputed from 3D in the computeProjection method. More...
 
Array< PolyLineline3D
 Relative to the "current" object to world matrix. More...
 
Array< Array< float > > lineDepth
 
Array< Array< float > > lineW
 
Array< ConvexPolygon2Dpoly2D
 Recomputed from 3D in the computeProjection method. More...
 
Array< ConvexPolygonpoly3D
 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...
 

Detailed Description


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.

Constructor & Destructor Documentation

◆ UIGeom()

G3D::_internal::UIGeom::UIGeom ( )
inline

Member Function Documentation

◆ computeEye()

static Vector3 G3D::_internal::UIGeom::computeEye ( RenderDevice rd)
staticprotected

Returns the object space eye point.

◆ computeProjection()

void G3D::_internal::UIGeom::computeProjection ( RenderDevice rd)

Computes the 2D positions from the 3D ones using the renderDevice and updates the zOrder.

◆ contains()

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.

Parameters
tangent2DReturns 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.
projectionWReturns the if close to a line.

◆ render()

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.

◆ segmentNormal()

static Vector3 G3D::_internal::UIGeom::segmentNormal ( const LineSegment seg,
const Vector3 eye 
)
staticprotected

Returns the normal to a line segment.

Member Data Documentation

◆ line2D

Array<PolyLine2D> G3D::_internal::UIGeom::line2D

Recomputed from 3D in the computeProjection method.

◆ line3D

Array<PolyLine> G3D::_internal::UIGeom::line3D

Relative to the "current" object to world matrix.

◆ lineDepth

Array< Array<float> > G3D::_internal::UIGeom::lineDepth

◆ lineW

Array< Array<float> > G3D::_internal::UIGeom::lineW

◆ m_twoSidedPolys

bool G3D::_internal::UIGeom::m_twoSidedPolys
protected

If true, backface polygons are tested for mouse clicks.

◆ poly2D

Array<ConvexPolygon2D> G3D::_internal::UIGeom::poly2D

Recomputed from 3D in the computeProjection method.

◆ poly3D

Array<ConvexPolygon> G3D::_internal::UIGeom::poly3D

Relative to the "current" object to world matrix.

◆ polyBackfacing

Array<bool> G3D::_internal::UIGeom::polyBackfacing

If last time we rendered the poly3D was backwards.

◆ polyDepth

Array< float > G3D::_internal::UIGeom::polyDepth

◆ visible

bool G3D::_internal::UIGeom::visible

documentation generated on Wed Nov 24 2021 08:02:03 using doxygen 1.8.15