int PEXOCCTMCoordFillAreaSet(
PEXOCC context,
PEXTMCoordData *tm_coord_data,
PEXPointer facet_data,
unsigned int count,
PEXListOfVertexData *vertex_lists
)
- context
- An OC context returned by a
successful PEXCreateOCC call.
- tm_coord_data
- A pointer to parameterization
data for this primitive.
(See Description below)
- facet_attributes (OCC)
- A mask indicating the facet attributes provided
(PEXGANone, PEXGAColor, PEXGANormal or
PEXGAFloatData).
- surface_vertex_attributes (OCC)
- A mask indicating the vertex attributes provided
(PEXGANone, PEXGAColor, PEXGANormal,
PEXGAEdges, PEXGA2D or
PEXGAFloatData).
- color_type (OCC)
- The type of color data
provided (PEXColorTypeIndexed,
PEXColorTypeRGB, PEXColorTypeCIE,
PEXColorTypeHSV, PEXColorTypeHLS,
PEXColorTypeRGB8, PEXColorTypeRGB16,
PEXColorTypeRGBA, PEXColorTypeRGBA8 or
PEXColorTypeRGBA16).
- facet_fp_data_count (OCC)
- The number of
optional floating-point numbers for each
facet.
- surface_vertex_fp_data_count (OCC)
- The number of floating-point data values defined with
each vertex.
- facet_data
- A pointer to the facet data.
See Data Formats.
- count
- The number of fill areas in the
set.
- vertex_lists
- A pointer to
the list of vertex arrays defining each contour of the fill
area set.
See Data Formats.
- data_model (OCC)
- Specifies the data model
used to represent the geometric data.
- data_model_specs (OCC)
- Offset and size data for the
PEXDataStride or
PEXDataUnpacked
data models.
Zero if
successful; otherwise, one of the following:
- PEXBadTMPrimitive
- Normals are not valid.
- PEXBadValue
- Projection type is not valid.
- PEXBadValue
- Texture coordinate location not
valid.
- PEXBadAlloc
- Internal allocation error has occurred.
Invoke PEXOCCTMCoordFillAreaSet to compute a
projection of texture coordinates onto a fill area set and
store them in the floating-point data areas of each
vertex.
To compute texture coordinates, the following values in the
tm_coord_data structure must be supplied by the
client:
- projection
- Texture coordinate projection to perform
(PEXTMProjectionSphereWC,
PEXTMProjectionCylinderWC,
or PEXTMProjectionLinearWC).
- matrix
- If projection is either
PEXTMProjectionSphereWC or
PEXTMProjectionCylinderWC, this transform is applied
to vertices and vertex normals after the mc_transform has
been applied.
It is used to orient the data relative to the projection
object (sphere or cylinder) as described.
- p0, p1
- If projection is
PEXTMProjectionLinearWC, then these elements contain
linear projection equations.
(See description below.)
- coord_source
- Source coordinate to compute
projections specified with projection type above
(PEXTMCoordSourceVertexCoord or
PEXTMCoordSourceVertexNormal).
- fp_data_index
- Index within the vertex
floating-point data list in which to store the calculated
texture coordinates.
Space must already exist in the vertex floating-point data
list and the index must point to a valid location.
The projection generates a data list of two consecutive
floating-point numbers.
- mc_transform
- This transform is applied to
vertices and vertex normals in model coordinates prior to
computing the specified projection.
Additionally, for the given projections, the
following information must be provided.
For projections listed below, those which require a unit
direction vector (s0,s1,s2) shall have
one determined by the coordinate source selection previously
mentioned.
If you select PEXTMCoordSourceVertexCoord, then a ray
is computed from the WC origin through the vertex to the
interior of the projection object.
If you select PEXTMCoordSourceVertexNormal, then the
primitive's vertex normals (given or implicit) are used to
determine the direction.
The resulting values (t0,t1) are the texture
coordinates stored at the requested index.
- PEXTMProjectionSphereWC
- The infinite sphere has (0,0,0) as its origin and
the +y axis as its axis of revolution.
The texture seam sweeps from the +x axis in a
counter-clockwise direction [0..2PI].
Given the specified coordinate source, a direction vector
(s0,s1,s2) is computed to determine a
point on the interior of the sphere.
The resulting texture coordinates (t0,t1) are
stored in the vertex's floating-point data list.
t0 = (s0 == 0.0) ? ((s2 > 0) ? 0.75 : 0.25) :
(-arctan(s2/s0) / (2 * PI) +
((s0 < 0) ? 0.5 : (s0 > 0 && s2 > 0) ? 1 : 0)
)
t1 = arcsin(s1) / PI + 0.5
-PI/2 <= arctan(r) <= PI/2
-PI/2 <= arcsin(r) <= PI/2
Where (s0*s0 + s1*s1 + s2*s2) = 1
- PEXTMProjectionCylinderWC
- The infinite cylinder has (0,0,0) as its origin
and the +y axis as its axis of revolution.
The texture seam sweeps from the +x axis in a
counter-clockwise direction [0..2PI].
Given coordinate sources which are directional (normal or
-reflection), a direction vector
(s0,s1,s2) is computed to determine a
point on the interior of the cylinder.
If the coordinate source is vertex coord, a ray
perpendicular to the +y axis through the vertex is
computed to determine a point and its height on the interior
of the cylinder.
The resulting texture coordinates (t0,t1) are
stored in the vertex's floating-point data list.
t0 = (s0 == 0.0) ? ((s2 > 0) ? 0.75 : 0.25) :
(-arctan(s2/s0) / (2 * PI) +
((s0 < 0) ? 0.5 : (s0 > 0 && s2 > 0) ? 1 : 0)
)
if (coord_source == normal)
t1 = arcsin(s1) / PI + 0.5
else
t1 = y_coord
-PI/2 <= arctan(r) <= PI/2
-PI/2 <= arcsin(r) <= PI/2
Where (s0*s0 + s1*s1 + s2*s2) = 1
- PEXExtTMProjectionLinearWC
- Arguments for two linear equations are defined as
p0 and p1.
Given the specified coordinate source, the values are used
directly as (s0,s1,s2) to linearly
project the values by the equations listed below.
The resulting texture coordinates (t0,t1) are
stored in the vertex's floating-point data list.
(where s3 is assumed to be one as shown in the
equations below.)
t0 = s0 * p0[0] + s1 * p0[1] + s2 * p0[2] + 1 * p0[3]
t1 = s0 * p1[0] + s1 * p1[1] + s2 * p1[2] + 1 * p1[3]
The projection of anything other than vertices for this option produces unpredictable visual results.
It is assumed that the vertex list of the
specified primitive has sufficient space to insert the
needed texture coordinates.
If space (indicated by PEXGAFloatData) or valid
indices for texture coordinates do not exist, then the
implementation issues an error and the data remains
unchanged.
None.
For a list of related topics and for a list of all texture
mapping functions, see Texture Mapping.