Back to the beginning of class HT_Renderer


HT_Renderer::draw_2d_elliptical_arc
HT_Renderer::draw_dc_elliptical_arc

Purpose

Draws an elliptical arc, specified with respect to device coordinates. Synopsis
    void draw_2d_elliptical_arc (HT_Rendition const & hr,
                                 HT_DC_Point const & center,
                                 HT_DC_Point const & radii,
                                 float start = 0.0f,
                                 float end = HK_Two_Pi,
                                 float tilt = 0.0f,
                                 HT_RGB32 * color = null) const {
            read().draw_2d_elliptical_arc (hr, center, radii, start, end, tilt, color);
    }
    void draw_dc_elliptical_arc (HT_Rendition const & hr,
                                 HT_DC_Point const & center,
                                 HT_DC_Point const & radii,
                                 float start = 0.0f,
                                 float end = HK_Two_Pi,
                                 float tilt = 0.0f,
                                 HT_RGB32 * color = null) const {
            read().draw_dc_elliptical_arc (hr, center, radii, start, end, tilt, color);
    }
    void draw_2d_elliptical_arc (HT_Rendition const & hr,
                                 HT_DCI_Point const & center,
                                 HT_DCI_Point const & radii,
                                 float start = 0.0f,
                                 float end = HK_Two_Pi,
                                 float tilt = 0.0f,
                                 HT_RGB32 * color = null) const {
            read().draw_2d_elliptical_arc (hr, center, radii, start, end, tilt, color);
    }
    void draw_dc_elliptical_arc (HT_Rendition const & hr,
                                 HT_DCI_Point const & center,
                                 HT_DCI_Point const & radii,
                                 float start = 0.0f,
                                 float end = HK_Two_Pi,
                                 float tilt = 0.0f,
                                 HT_RGB32 * color = null) const {
            read().draw_dc_elliptical_arc (hr, center, radii, start, end, tilt, color);
    }
Details center is the center of the ellipse containing the arc.  radii.x and radii.y are the semi-axes of the ellipse containing the arc.

start and end are the parameter values of the start and end points, where the parameterization runs from 0 to 2p as the entire closed ellipse is described, beginning and ending at the point where the ellipse intersects its axis parallel to the positive X axis. When specifying an arc that crosses the "start/finish line" at 2p,  the start should be less than the end and the end can be >2p . This parameterization criteria is similar for  draw_dc_ellipse.  If tilt is specified, the ellipse is rotated about its center point.

color specifies the drawing color when it is not null; otherwise, the rendition color is used.

Figure 2 is an example of the ellipse parameters for the elliptical arc.
 
 

Figure 2. Ellipse parameters—elliptical arc


HT_Renderer::draw_2d_gouraud_polyline
HT_Renderer::draw_dc_gouraud_polyline

Purpose

Draws a Gouraud shaded polyline, specified in device coordinates. Synopsis Details count is the number of vertices, that is, one plus the number of polyline segments.

points points to an array of vertices giving the polyline vertices in order.

colors contains an array of count colors, one for each vertex of the polyline, which the renderer should interpolate between for each segment of the polyline.

You can punt to the standard Gouraud polyline routine for Gouraud polylines that you cannot draw: HD_Standard_Draw_2D/DC_Gouraud_Polyline ().
 
 


HT_Renderer::draw_2d_gouraud_polytriangle
HT_Renderer::draw_dc_gouraud_polytriangle

Purpose

Draws a Gouraud shaded triangle strip, of one or more triangles, specified with respect to device coordinates. Synopsis Details count is the number of vertices of the polytriangle.

points points to an array of count points, forming count-2 triangles. Each triple of successive points are the vertices of one triangle of the strip. A Gouraud polytriangle example is illustrated in figure 3.
 
 

Figure 3. Six point Gouraud polytriangle
colors contains an array of count colors specifying the colors at each vertex of the polytriangle. The driver should interpolate the colors across the face of each triangle based on the color at the vertices of each triangle.

You can punt to either of the following standard Gouraud polytriangle routines for Gouraud polytriangles that you cannot draw:

HD_Standard_Draw_2D_Gouraud_Polytriangle ()
HD_Standard_Draw_DC_Gouraud_Polytriangle ()
 

HT_Renderer::draw_2d_image
HT_Renderer::draw_dc_image

Purpose

Generalized image drawing. Synopsis
void draw_2d_image (
    HT_Rendition const & hr,
    HT_DC_Point const & ul,
    HT_Shared_Image const & image) const 
void draw_dc_image (
    HT_Rendition const & hr,
    HT_DC_Point const & ul,
    HT_Shared_Image const & image) const 
void draw_2d_image (
    HT_Rendition const & hr,
    HT_DCI_Point const & ul,
    HT_Shared_Image const & image) const 
void draw_dc_image (
    HT_Rendition const & hr,
    HT_DCI_Point const & ul,
    HT_Shared_Image const & image) const
Details This routine calls on one of the explicit image drawing actions, draw_2d/dc_index8_image, draw_2d/dc_rgb32_image, draw_2d/dc_depth16_image, or draw_2d/dc_depth32_image, according to the value of the format member in image.

The image insertion point, the upper left hand corner, is at ul.


HT_Renderer::draw_2d_polygon
HT_Renderer::draw_dc_polygon

Purpose

Draws a filled polygon, specified in device coordinates. Synopsis
void draw_2d_polygon (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points,
    HT_RGB32 * color = null) 
void draw_dc_polygon (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points,
    HT_RGB32 * color = null) const 
void draw_2d_polygon (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points,
    HT_RGB32 * color = null) const 
void draw_dc_polygon (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points,
    HT_RGB32 * color = null) const
Details This draws a filled polygon specified by count and points which may have arbitrary complexity. Specifically, the face boundary is a closed, connected polyline. It may enclose a non-convex region, but may not intersect itself.

The polygon is filled with a constant color, determined by the face color attribute in the rendition, possibly overlaid with a pattern given by the face pattern and contrast color attributes.

This routine does not draw a polygon edge distinct from the face color. An application which wants edged polygons must explicitly draw the edge with a call to draw_2d/dc_polyline.
 
 


HT_Renderer::draw_2d_polyline
HT_Renderer::draw_dc_polyline

Purpose

Draws a polyline, specified in device coordinates. Synopsis
void draw_2d_polyline (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points) const 
void draw_dc_polyline (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points) const 
void draw_2d_polyline (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points) const 
void draw_dc_polyline (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points) const
Details This draws a continuous polyline of constant color.

count is the number of vertices, that is, one plus the number of polyline segments.

points points to an array of polyline vertices in order.

All drivers normally supply at least the function to draw solid lines of weight 1. You can punt to the standard polyline routine HD_Standard_Draw_2D/DC_Polyline() for polylines that you cannot draw.


HT_Renderer::draw_2d_polymarker
HT_Renderer::draw_dc_polymarker

Purpose

Draws a set of markers at positions specified in device coordinates. Synopsis
void draw_2d_polymarker (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points) const 
void draw_dc_polymarker (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points) const 
void draw_2d_polymarker (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points) 
void draw_dc_polymarker (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points) const
Details This draws a set of markers of type determined by the value of the marker symbol attribute.

count is the number of polymarkers to draw.

points points to an array of polymarker vertices.


HT_Renderer::draw_2d_polytriangle
HT_Renderer::draw_dc_polytriangle

Purpose

Draws a filled triangle strip, of one or more triangles, specified with respect to device coordinates. Synopsis
void draw_2d_polytriangle (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points) const 
void draw_dc_polytriangle (
    HT_Rendition const & hr,
    int count,
    HT_DC_Point const *points) const 
void draw_2d_polytriangle (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points) 
void draw_dc_polytriangle (
    HT_Rendition const & hr,
    int count,
    HT_DCI_Point const *points) const
Details count is the number of vertices of the polytriangle.

points() points to an array of count points, forming count-2 triangles. Each triple of successive points are the vertices of one triangle of the strip.

This routine does not draw a triangle edge distinct from the face color. An application which wants edged polygons must explicitly draw in the edge with a call to draw_2d/dc_polyline.
Figure 4 is an example of a six point polytriangle.

Figure 4. Six point polytriangle


HT_Renderer::draw_2d _text

Purpose

This action draws 2D text similar to other geometry, instead of directly calling the Font Engine. Synopsis
        void draw_2d_text (HT_Rendition const & hr,
                           HT_DC_Point const & point,
                           char * string,
                           int length = -1) const 
       
        void draw_2d_text (HT_Rendition const & hr,
                           HT_DCI_Point const & point,
                           char * string,
                           int length = -1) const 
       
        void draw_2d_text (HT_Rendition const & hr,
                           HT_DC_Point const & point,
                           unsigned short * string,
                           int length) const 
       
        void draw_2d_text (HT_Rendition const & hr,
                           HT_DCI_Point const & point,
                           unsigned short * string,
                           int length) const
Details The result of the default actions is the same as if you directly called the draw functions on the Font_Engine. In the default implementation the draw_3d_text action transforms the point and calls the draw_2d_text action.  The (float) 2d_text converts to int and calls the int version of 2d_text.  The int version then calls out to the Font_Engine associated with the font on the Rendition.

This new scheme allows a renderer to replace the text actions and treat text as just another piece of geometry.  For example, a renderer that stores geometry and replays it back later (that is, sorted by position, or multiple times for banded plotting) no longer needs to have special code to deal with text or force tessellation of text into "simple" geometry for storage.

HT_Text is a new class with a different constructor to handle a single or double precision position, and either normal chars, with optional length, or wide chars ¾ unsigned short.

For more information, see draw_3d_text and HT_Font_Engine.



HT_Renderer::draw_2d _textured_polyline
HT_Renderer::draw_dc_textured_polyline

Purpose

Draws a filled series of polylines with a given texture map. Synopsis Attributes HT_Perspective_Correction None mode specifies no correction.
Parameter mode specifies the correction applied to (u,v,w)  coordinates.
Color mode specifies the correction  applied to the color.
World mode specifies that the  correction is applied to World Coordinates.
All  mode specifies that correction is applied to all of  the above coordinates.


HT_Shader

The generic way of modifying the color of the object. The diffuse texture option is used most often.
Details This is an enhanced version of draw_2d/dc_polyline. In addition to the regular count and pointer for the vertices, textured polylines have a list of colors, texture parameters, perspective correction terms ws, and normals per vertex, while the latter two are optional.

The perspective correction terms, ws, can be explained as follows. In computer graphics it is usual practice to transform a vertex or point from 3D to dc by

[x,y,z, 1] * M => [x',y',z',w],
where M is the 4 x 4 homogeneous transformation matrix and w is the perspective correction term. Then, it is necessary to divide the [x',y',z'] by w to get [x'',y'',z''] in dc. In other words, for each vertex there is a w term for the perspective division, and texture mapping u,v values need these w terms to correctly interpolate the texture. Thus, ws is an array of these w terms.

The interface now allows for "n" triplets of texture vertex parameter data to be associated with each vertex .  The first place this is seen is in the set_vertex_parameters() member function of HT_Tristrip. Additionally, this new information needs to be passed on through to all the functions that may make use of it.  In all cases it is an optional int function argument also defaulting to 1, added immediately after the HT_Parameter * param argument. For more information see HT_Vertex_Set_Data::set_vertex_parameters.
 



HT_Renderer::draw_2d _textured_polymarker
HT_Renderer::draw_dc_textured_polymarker

Purpose

Draws a filled series of polymarkers with a given texture map. Synopsis Attributes HT_Perspective_Correction None mode specifies no correction.
Parameter mode specifies the correction applied to (u,v,w)  coordinates.
Color mode specifies the correction  applied to the color.
World mode specifies that the  correction is applied to World Coordinates.
All  mode specifies that correction is applied to all of  the above coordinates.


HT_Shader

The generic way of modifying the color of the object. The diffuse texture option is used most often.
Details This is an enhanced version of draw_2d/dc_polymarker.  In addition to the regular count and pointer for the vertices, textured polymarkers have a list of colors, texture parameters, perspective correction terms ws, and normals per vertex, while the latter two are optional.

The perspective correction terms, ws, can be explained as follows. In computer graphics it is usual practice to transform a vertex or point from 3D to dc by

[x,y,z, 1] * M => [x',y',z',w],
where M is the 4 x 4 homogeneous transformation matrix and w is the perspective correction term. Then, it is necessary to divide the [x',y',z'] by w to get [x'',y'',z''] in dc. In other words, for each vertex there is a w term for the perspective division, and texture mapping u,v values need these w terms to correctly interpolate the texture. Thus, ws is an array of these w terms.

The interface now allows for "n" triplets of texture vertex parameter data to be associated with each vertex .  The first place this is seen is in the set_vertex_parameters() member function of HT_Tristrip. Additionally, this new information needs to be passed on through to all the functions that may make use of it.  In all cases it is an optional int function argument also defaulting to 1, added immediately after the HT_Parameter * param argument. For more information see HT_Vertex_Set_Data::set_vertex_parameters.



HT_Renderer::draw_2d _textured_polytriangle
HT_Renderer::draw_dc_textured_polytriangle

Purpose

Draws a filled series of triangles with a given texture map. Synopsis Attributes
HT_Perspective_Correction
None mode  specifies no correction.
Parameter mode specifies the correction applied to (u,v,w)  coordinates.
Color mode specifies the correction  applied to the color.
World mode specifies that the  correction is applied to World Coordinates.
All  mode specifies that correction is applied to all of  the above coordinates.
HT_Shader
The generic way of modifying the color of the object. The diffuse texture option is used most often.
Details This is an enhanced version of draw_2d/dc_polytriangle. In addition to the regular count and pointer for the vertices, textured polytriangles have a list of colors, texture parameters, perspective correction terms ws, and normals per vertex, while the latter two are optional.

The perspective correction terms ws can be explained as follows. In computer graphics, it is usual practice to transform a vertex or point from 3D to dc by

[x,y,z, 1] * M => [x',y',z',w],
where M is the 4 x 4 homogeneous transformation matrix and w is the perspective correction term. Then it is necessary to divide the [x',y',z'] by w to get [x'',y'',z''] in dc. In other words, for each vertex there is a w term for the perspective division. And texture mapping u,v values need these w terms to correctly interpolate the texture.

ws, therefore, is an array of these w terms.

The interface now allows for "n" triplets of texture vertex parameter data to be associated with each vertex .  The first place this is seen is in the set_vertex_parameters() member function of HT_Tristrip. Additionally, this new information needs to be passed on through to all the functions that may make use of it.  In all cases it is an optional int function argument also defaulting to 1, added immediately after the HT_Parameter * param argument. For more information see HT_Vertex_Set_Data::set_vertex_parameters.



HT_Renderer::draw_3d_linestrip

Purpose

Draws a series of connected lines, specified in 3D object coordinates and including vertex normals, colors, and texture mapping parameters. Synopsis
void draw_3d_linestrip (
    HT_Rendition const *    hr,
    HT_Linestrip const *    markerstrip // Marker strip descriptor
)
Details This is used to draw a polyline with additional vertex parameters such as colors, normals, and texture map parameters.

The linestrip->points() array points to the first vertices of all the line segments.

linestrip->connectivity(), if not null, defines the sequences of the polyline vertices. It is composed of integers of vertex, vertex, line, vertex, line, ..., ~vertex, ~line. The first two elements are the vertices of the first line segment followed by a segment number used to index the linestrip->line_colors() and linestrip->line_normals() arrays.

Note: The last vertex and last line index are specified as a one’s-complement of the vertex number and line number to indicate the end of the connectivity list. Since indexes must be 0 or greater the one's-complement will always be less than 0.

For example, a list of 0,1,0,2,1,3,2,~5,3,6,7,4,~4,~5 means vertices 0 and 1 form line 0; vertices 1 and 2 form line 1; vertices 2 and 3 form line 2, vertices 3 and ~(~5) form line 3 and we are done with the first substrip. Starting anew, vertices 6 and 7 form line 4; vertices 7 and ~(~4) form line ~(~5) and this is the end of the second substrip and the end of the linestrip. The sample linestrip for the list

sample list = { 0,1,0,2,1,3,2,~5,3,6,7,4,~4,~5 }
is shown in figure 5.
Figure 5. Sample linestrip
linestrip->vertex_colors(), if not null, points to the first of an array of colors associated with the vertices. The color associated with a particular vertex has the same index in this array as the vertex has in linestrip->points().

linestrip->vertex_normals(), if not null, points to the first of an array of normal vectors associated with vertices.

linestrip->vertex_parameters(), if not null, points to the first of an array of texture map coordinates associated with vertices. When texture mapping is in effect, it points to an array of HT_Parameter. An HT_Parameter consists of a triplet of floats per vertex, containing the u, v, and w parameters.
The interface now allows for "n" triplets of texture vertex parameter data to be associated with each vertex .  The first place this is seen is in the set_vertex_parameters() member function of HT_Tristrip. Additionally, this new information needs to be passed on through to all the functions that may make use of it.  In all cases it is an optional int function argument also defaulting to 1, added immediately after the HT_Parameter * param argument. For more information see HT_Vertex_Set_Data::set_vertex_parameters.

linestrip->line_colors(), if not null, points to the first of an array of colors associated with each line segment. The color associated with a particular segment is referenced by the line segment definitions in the connectivity array.

See Also HT_Linestrip



HT_Renderer::draw_3d_markerstrip

Purpose

Draws a series of markers, specified in 3D object coordinates. Synopsis
void draw_3d_markerstrip (
    HT_Rendition const * hr,
    HT_Markerstrip const * markerstrip // Marker strip descriptor
)
Details This is used to draw sequences of markers with associated vertex colors, vertex normals, and texture map parameters, specified in 3D object coordinates.

The markerstrip->points() array points to the first of an array of 3D points that contain the vertices of all the markers in the list.

markerstrip->connectivity(), if not null, defines the sequences of the marker locations. The connectivity array is composed of integers of vertex, vertex, ..., ~vertex, containing the drawing order of marker vertices.

Note: The last vertex is specified as a one’s-complement of the vertex number to indicate the end of the connectivity list.

markerstrip->vertex_colors(), if not null, points to the first of an array of colors associated with the vertices. The color associated with a particular vertex has the same index in the this array as the vertex in markerstrip->points().

markerstrip->vertex_normals(), if not null, points to the first of an array of normal vectors associated with vertices.

markerstrip->vertex_parameters(), if not null, points to texture mapping coordinates associated with vertices. When texture mapping is in effect, it points to an array of HT_Parameter associated with the vertices.  An HT_Parameter consists of a triplet of floats per vertex, containing the u, v, and w parameters.
The interface now allows for "n" triplets of texture vertex parameter data to be associated with each vertex .  The first place this is seen is in the set_vertex_parameters() member function of HT_Tristrip. Additionally, this new information needs to be passed on through to all the functions that may make use of it.  In all cases it is an optional int function argument also defaulting to 1, added immediately after the HT_Parameter * param argument. For more information see HT_Vertex_Set_Data::set_vertex_parameters.

See Also HT_Markerstrip

Note: For a continuation of class HT_Renderer,  go to the draw_3d_polygon method