VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
makVrv::DtDecalProjectorComponent Class Reference

A class which represents a component for a decal projector.

This is part of a component/system concept. In this case the system portion is handled by DtDecalProjectorRenderer.

To use this component, you get the DtDecalProjectorRenderer from the DtOverlayRenderer that you are working with. Then call createComponent using the DtDecalProjectorRenderer::createComponent method. The component takes care of registering/unregistering itself with the DtDecalProjectorRenderer, but you must handle freeing the component when no longer using it because DtDecalProjectorRenderer does not own it.

This component is used for projecting geometry onto a surface/terrain. Triangles and lines are currently supported by the renderer. The staging geometry in general is meant to lay on the same plane but it does not have to be perfectly flat.

Inheritance diagram for makVrv::DtDecalProjectorComponent:
Inheritance graph
[legend]

Classes

struct  DrawPassData
 
struct  StagingPoint
 
struct  TopoPoint
 

Public Member Functions

virtual ~DtDecalProjectorComponent ()
 
virtual void setProjectionRange (float projNear, float projFar)
 
virtual void projectionRange (float &projNear, float &projFar) const
 
virtual void resizeStagingVertexCount (size_t size)
 
virtual void setStagingVertexPosition (unsigned int index, double x, double y, double z)
 
virtual void expandStagingPointsToLines ()
 
virtual void expandStagingPointsToLineQuads (float lineWidth)
 
virtual void stagingGeometryUpdated ()
 
virtual void setColor (float r, float g, float b, float a)
 
virtual void getColor (float &r, float &g, float &b, float &a) const
 
virtual void projectUVCoordinates (const DtVector &origin, const DtVector &axisU, const DtVector &axisV)
 
virtual void getUVCoordinateProjection (DtVector3< float > &origin, DtVector3< float > &axisU, DtVector3< float > &axisV) const
 
virtual void setStipplePattern (unsigned int stipplePattern[32]=0)
 
virtual const unsigned intgetStipplePattern () const
 
virtual void setFillPatternFrequency (float frequency) override
 
virtual float fillPatternFrequency () const override
 
virtual void setAllowAltitudeTileMultiplier (bool allow)
 
virtual bool allowAltitudeTileMultiplier () const
 
virtual bool allowSparseTiling () const
 
virtual void setTexture (DtTextureInterface *texture)
 
virtual DtTextureInterfacetexture () const
 
virtual bool pick (double x, double y, double z) const
 
- Public Member Functions inherited from makVrv::DtDecalProjectorComponentInterface
 DtDecalProjectorComponentInterface ()
 
virtual ~DtDecalProjectorComponentInterface ()
 

Protected Member Functions

 DtDecalProjectorComponent (DtDecalProjectorRenderer &renderer)
 
void setStagingPointFromVector (StagingPoint &outPoint, const DtVector &inPoint) const
 
virtual void computeTopoTransform (DtCoordTransform &geocToTopo, DtVector &geocentricOrigin, const DtVector &localOrigin, DtCoordinateSystem &coordinateSystem) const
 
virtual void updateProjectedUVCoordinates ()
 
virtual void computeDrawPasses ()
 
virtual void computeDrawPassBounds ()
 
virtual void computeProjectionRangeFromArea (float boundsSizeX, float boundsSizeY)
 
void drawPassTransform (DtVector3< double > &origin, float *rotation) const
 
void drawPassBoundingSphere (DtVector3< float > &center, float &radius) const
 
size_t drawPassCount () const
 
size_t passPointCount (unsigned int pass) const
 
const void * passPoints (unsigned int pass) const
 
const void * passPointsUVs (unsigned int pass) const
 
void passBounds (unsigned int pass, DtVector &boundsMin, DtVector &boundsMax)
 
bool pickTriangles (const DtVector3< float > &localPoint) const
 
bool pickLines (const DtVector3< float > &localPoint, float radius) const
 
bool pointInTriangle (const DtVector3< float > &point, const DtDecalProjectorComponent::TopoPoint pointA, const DtDecalProjectorComponent::TopoPoint pointB, const DtDecalProjectorComponent::TopoPoint pointC) const
 
float squaredDistanceToLine (const DtVector3< float > &point, const DtDecalProjectorComponent::TopoPoint pointA, const DtDecalProjectorComponent::TopoPoint pointB) const
 

Static Protected Member Functions

static void setPickLineRadius (float radius)
 

Protected Attributes

DtDecalProjectorRenderermyRenderer
 
float myProjectionRangeNear
 
float myProjectionRangeFar
 
bool myAutoProjectionRange
 
unsigned int myStipplePattern [32]
 
float myColor [4]
 
float myFillPatternFrequency
 
DtTextureInterfacemyTexture
 
bool myAllowAltitudeTileMultiplier
 
bool myUseProjectedTextureCoordinates
 
DtVector3< float > myProjCoordsOrigin
 
DtVector3< float > myProjCoordsAxisU
 
DtVector3< float > myProjCoordsAxisV
 
DtVector myDrawPassOrigin
 
DtQuat myDrawPassRotationInvQuat
 
float myDrawPassRotation [16]
 
DtVector3< float > myDrawPassBoundsCenter
 
float myDrawPassBoundsRadius
 
std::vector< StagingPointmyStagingPoints
 
std::vector< TopoPointmyTopoPoints
 
std::vector< TopoPointmyTopoPointsUVs
 
std::vector< DrawPassDatamyDrawPasses
 

Static Protected Attributes

static float thePickLineRadius
 

Friends

class DtDecalProjectorComponentCreator
 
class DtDecalProjectorRenderer
 
class DtDecalProjectorLineRenderer
 

Additional Inherited Members

- Public Types inherited from makVrv::DtDecalProjectorComponentInterface
enum  RenderingType { RenderingTypeLine = 0, RenderingTypeTriangle }
 

Constructor & Destructor Documentation

virtual makVrv::DtDecalProjectorComponent::~DtDecalProjectorComponent ( )
virtual

DTOR.

makVrv::DtDecalProjectorComponent::DtDecalProjectorComponent ( DtDecalProjectorRenderer renderer)
protected

CTOR.

Member Function Documentation

virtual void makVrv::DtDecalProjectorComponent::setProjectionRange ( float  projNear,
float  projFar 
)
virtual

Sets the back/forward projection range of the decal. The range is in reference to the origin of the points. This is similar to a near/far clip range.

Parameters
projNearThe near distance to project (can be negative behind the origin)
projFarThe far distance to project (should be > projNear) example: setProjectionRange(-100.0, 500.0) would project on something up to 100 meters behind the origin and 500 meters in front of the origin.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::projectionRange ( float &  projNear,
float &  projFar 
) const
virtual

Gets the back/forward projection range of the decal. (see setProjectionRange)

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::resizeStagingVertexCount ( size_t  size)
virtual

Sets the current staging vertex count.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::setStagingVertexPosition ( unsigned int  index,
double  x,
double  y,
double  z 
)
virtual

Sets the position of a staging vertex.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::expandStagingPointsToLines ( )
virtual

Takes the current staging points and treats them as a segmented line. Expands staging points to hold unique points for each primitive.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::expandStagingPointsToLineQuads ( float  lineWidth)
virtual

Takes the current staging points and treats them as a segmented line. Each line will be converted to 2 triangles that form a quad in the topo plane. Expands staging points to hold unique points for each primitive.

Parameters
lineWidthThe width in meters of the line quad

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::stagingGeometryUpdated ( )
virtual

Called after all staging gemoetry has been updated. Internally computes bounding information, and prepares data for rendering draw passes.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::setColor ( float  r,
float  g,
float  b,
float  a 
)
virtual

Set the color of all vertices.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::getColor ( float &  r,
float &  g,
float &  b,
float &  a 
) const
virtual

Get the color of all vertices.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::projectUVCoordinates ( const DtVector origin,
const DtVector axisU,
const DtVector axisV 
)
virtual

Does uv coordinate projection based on the current vertex positions and the given projection parameters.

Parameters
origin- each vertex position will subtract the origin
axisU- the X axis to project the position along for the u coordinate
axisV- the Y axis to project the position along for the v coordinate

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::getUVCoordinateProjection ( DtVector3< float > &  origin,
DtVector3< float > &  axisU,
DtVector3< float > &  axisV 
) const
virtual
virtual void makVrv::DtDecalProjectorComponent::setStipplePattern ( unsigned int  stipplePattern[32] = 0)
virtual

Set a stipple pattern to be used for rendering.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual const unsigned int* makVrv::DtDecalProjectorComponent::getStipplePattern ( ) const
virtual

Get the stipple pattern used for rendering.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::setFillPatternFrequency ( float  frequency)
overridevirtual

Sets the fill pattern tiling frequency. The frequency needs to be 1 / x where x is a whole number. examples: frequency = 1.0 : the tiled pattern will tile normally frequency = 0.5 : the tiled pattern will appear half as often.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual float makVrv::DtDecalProjectorComponent::fillPatternFrequency ( ) const
overridevirtual

Returns the fill pattern tiling frequency.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual void makVrv::DtDecalProjectorComponent::setAllowAltitudeTileMultiplier ( bool  allow)
virtual

The texture tiling will be modified at descrete levels based on viewing from different altitudes. This method sets whether or not that should be allowed.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual bool makVrv::DtDecalProjectorComponent::allowAltitudeTileMultiplier ( ) const
virtual

The texture tiling will be modified at descrete levels based on viewing from different altitudes. This method returns whether or not that should be allowed.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual bool makVrv::DtDecalProjectorComponent::allowSparseTiling ( ) const
virtual

The texture image can be set up to use a sparse tiling effect when texture tiling is used. In the case where texture uv coordinates were specifically defined and not automatically projected,the sparse tiling effect should not be used. This method returns true if the sparse tiling is allowed.

virtual void makVrv::DtDecalProjectorComponent::setTexture ( DtTextureInterface texture)
virtual

Sets a texture handle to use for rendering. The texture will be used instead of the stipple pattern.

Parameters
textureThe texture handle from DtOverlayResourceProvider.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual DtTextureInterface* makVrv::DtDecalProjectorComponent::texture ( ) const
virtual

Gets the texture handle used for rendering.

Implements makVrv::DtDecalProjectorComponentInterface.

virtual bool makVrv::DtDecalProjectorComponent::pick ( double  x,
double  y,
double  z 
) const
virtual

Returns true if the given location would be in the decal projection space.

Parameters
(x,y,z)The surface location in local VRV space

Implements makVrv::DtDecalProjectorComponentInterface.

void makVrv::DtDecalProjectorComponent::setStagingPointFromVector ( StagingPoint outPoint,
const DtVector inPoint 
) const
protected

Helper to set a staging point position value from a DtVector.

virtual void makVrv::DtDecalProjectorComponent::computeTopoTransform ( DtCoordTransform &  geocToTopo,
DtVector geocentricOrigin,
const DtVector localOrigin,
DtCoordinateSystem coordinateSystem 
) const
protectedvirtual

Helper method to compute the current topo coordinate transform based on the current coordinate system and first vertex location.

virtual void makVrv::DtDecalProjectorComponent::updateProjectedUVCoordinates ( )
protectedvirtual

Updates uv coordinates for the current geometry with the current uv projection settings.

virtual void makVrv::DtDecalProjectorComponent::computeDrawPasses ( )
protectedvirtual

Computes the draw pass data needed based on the renderer point count limit and the primitive topology (triangle, line, etc...). Creates "bins" of data that can then be aquired by the renderer for each draw pass.

virtual void makVrv::DtDecalProjectorComponent::computeDrawPassBounds ( )
protectedvirtual

Computes the bounds for each draw pass. XY planer bounds is computed from points and Z bounds is set from the member variable (myProjectionRangeNear and myProjectionRangeFar).

virtual void makVrv::DtDecalProjectorComponent::computeProjectionRangeFromArea ( float  boundsSizeX,
float  boundsSizeY 
)
protectedvirtual

This is called to compute the projection range based on the given xy bounds size. This is olny called when myAutoProjectionRange is true. myAutoProjectionRange is true by default, but set to false if the projection range is set manually with setProjectionRange.

Parameters
boundsSizeX- The current bounds size in the x direction
boundsSizeY- The current bounds size in the y direction
void makVrv::DtDecalProjectorComponent::drawPassTransform ( DtVector3< double > &  origin,
float *  rotation 
) const
protected

Gets the transform used for drawing the decals.

Parameters
originThe parameter to receive the origin
rotationThe parameter to receive the rotation in the form of a 4x4 matrix array of 16 floats
void makVrv::DtDecalProjectorComponent::drawPassBoundingSphere ( DtVector3< float > &  center,
float &  radius 
) const
protected

Gets the bounding sphere of all draw passes.

size_t makVrv::DtDecalProjectorComponent::drawPassCount ( ) const
protected
size_t makVrv::DtDecalProjectorComponent::passPointCount ( unsigned int  pass) const
protected

Returns the number of points available for the given pass index.

Parameters
passThe draw pass index.
const void* makVrv::DtDecalProjectorComponent::passPoints ( unsigned int  pass) const
protected

Returns the 3D points local to the transform for the given draw pass index.

Parameters
passThe draw pass index.
const void* makVrv::DtDecalProjectorComponent::passPointsUVs ( unsigned int  pass) const
protected

Returns the 3D points uv's for the given draw pass index.

Parameters
passThe draw pass index.
void makVrv::DtDecalProjectorComponent::passBounds ( unsigned int  pass,
DtVector boundsMin,
DtVector boundsMax 
)
protected

Gets the local bounds for the given draw pass index.

Parameters
passThe draw pass index.
bool makVrv::DtDecalProjectorComponent::pickTriangles ( const DtVector3< float > &  localPoint) const
protected

Helper for pick method to pick local triangles. Returns true if the point is in a triangle.

bool makVrv::DtDecalProjectorComponent::pickLines ( const DtVector3< float > &  localPoint,
float  radius 
) const
protected

Helper for pick method to pick local lines. Returns true if the point is within the radius of the line.

bool makVrv::DtDecalProjectorComponent::pointInTriangle ( const DtVector3< float > &  point,
const DtDecalProjectorComponent::TopoPoint  pointA,
const DtDecalProjectorComponent::TopoPoint  pointB,
const DtDecalProjectorComponent::TopoPoint  pointC 
) const
protected

Checks if the given point is in the given triangle. This check is 2D only. This method is in an inner loop so no virtual.

float makVrv::DtDecalProjectorComponent::squaredDistanceToLine ( const DtVector3< float > &  point,
const DtDecalProjectorComponent::TopoPoint  pointA,
const DtDecalProjectorComponent::TopoPoint  pointB 
) const
protected

Computes the distance from the given point to the given line. This check is 2D only. This method is in an inner loop so no virtual.

static void makVrv::DtDecalProjectorComponent::setPickLineRadius ( float  radius)
staticprotected

This sets the physical line radius (in meters) when computing if a line was picked or not during line picking. This may or may not match the size of the visual.

Parameters
radius- The desired radius in meters

Friends And Related Function Documentation

friend class DtDecalProjectorComponentCreator
friend
friend class DtDecalProjectorRenderer
friend
friend class DtDecalProjectorLineRenderer
friend

Member Data Documentation

float makVrv::DtDecalProjectorComponent::thePickLineRadius
staticprotected

This is used as the physical line radius (in meters) when computing if a line was picked or not during line picking. This may or may not match the size of the visual. A customer could override this if desired.

DtDecalProjectorRenderer& makVrv::DtDecalProjectorComponent::myRenderer
protected
float makVrv::DtDecalProjectorComponent::myProjectionRangeNear
protected
float makVrv::DtDecalProjectorComponent::myProjectionRangeFar
protected
bool makVrv::DtDecalProjectorComponent::myAutoProjectionRange
protected
unsigned int makVrv::DtDecalProjectorComponent::myStipplePattern[32]
protected
float makVrv::DtDecalProjectorComponent::myColor[4]
protected
float makVrv::DtDecalProjectorComponent::myFillPatternFrequency
protected
DtTextureInterface* makVrv::DtDecalProjectorComponent::myTexture
protected
bool makVrv::DtDecalProjectorComponent::myAllowAltitudeTileMultiplier
protected
bool makVrv::DtDecalProjectorComponent::myUseProjectedTextureCoordinates
protected
DtVector3<float> makVrv::DtDecalProjectorComponent::myProjCoordsOrigin
protected
DtVector3<float> makVrv::DtDecalProjectorComponent::myProjCoordsAxisU
protected
DtVector3<float> makVrv::DtDecalProjectorComponent::myProjCoordsAxisV
protected
DtVector makVrv::DtDecalProjectorComponent::myDrawPassOrigin
protected
DtQuat makVrv::DtDecalProjectorComponent::myDrawPassRotationInvQuat
protected
float makVrv::DtDecalProjectorComponent::myDrawPassRotation[16]
protected
DtVector3<float> makVrv::DtDecalProjectorComponent::myDrawPassBoundsCenter
protected
float makVrv::DtDecalProjectorComponent::myDrawPassBoundsRadius
protected
std::vector<StagingPoint> makVrv::DtDecalProjectorComponent::myStagingPoints
protected
std::vector<TopoPoint> makVrv::DtDecalProjectorComponent::myTopoPoints
protected
std::vector<TopoPoint> makVrv::DtDecalProjectorComponent::myTopoPointsUVs
protected
std::vector<DrawPassData> makVrv::DtDecalProjectorComponent::myDrawPasses
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)