PEXOCCSpheres - Sphere Primitive (5.2)


Synopsis

 
     void PEXOCCSpheres(
          PEXOCC context,
          double radius,
          unsigned int count,
          PEXPointer spheres
     )
 

Arguments

context
An OC context returned by a successful PEXCreateOCC call.

display (OCC)
A pointer to a display structure returned by a successful XOpenDisplay call.

resource_id (OCC)
The resource identifier of the renderer or structure.

req_type (OCC)
The request type for the output command (PEXOCRender, PEXOCStore, PEXOCRenderSingle or PEXOCStoreSingle).

color_type (OCC)
The type of color for the spheres (PEXColorTypeIndexed, PEXColorTypeRGB, PEXColorTypeCIE, PEXColorTypeHSV, PEXColorTypeHLS, PEXColorTypeRGB8, PEXColorTypeRGB16, PEXColorTypeRGBA, PEXColorTypeRGBA8, or PEXColorTypeRGBA16).

surface_vertex_attributes (OCC)
A mask indicating the vertex attributes provided (PEXGAColor, PEXGARadius, PEXGAFloatData).

surface_fp_data_count (OCC)
Number of floats provided for each vertex.

radius
The radius of the spheres.

count
The number of spheres.

spheres
A pointer to the sphere vertex data. See Facet / Vertex 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.

Returns

None.

Description

Invoke PEXOCCSpheres to create a primitive output command to independently render each sphere in a set of spheres (PEXOCSphereSetWithData).

Each sphere is a three-dimensional surface which has points that are all equidistant from its center vertex. Define the center vertex and radius of each circle in modeling coordinates.

For the purposes of surface parameterization, the u value is mapped to the full circle contained in the plane of constant Y that intersects the center of the sphere, with the radius of the circle the same as that of the sphere. The point at which u = 0.0 is the point on this circle at which X equals sphere_center.x + radius. The value of u increases as the circle is swept in a counter-clockwise direction when viewed from a point above (larger Y value) than the plane of the circle. u reaches the value of 1.0 as the starting point of the sweep (at u = 0.0) is reached.

For purposes of surface parameterization, the v value is mapped to the full circle contained in the plane of constant X that intersects the center of the sphere, with the radius of the circle the same as that of the sphere. The point at which v = 0.0 is the point on this circle where Z equals sphere_center.z + radius. The value of v increases as the circle is swept in a counter-clockwise direction when viewed from a point to the right (larger X value) than the plane of the circle. v reaches the value of 1.0 as the starting point of the sweep (at v = 0.0) is reached.

Surface_vertex_attributes indicates the optional data specified for the center vertex of each sphere. The supported components of the bitmask are PEXGAColor PEXGARadius and PEXGAFloatData.

Clipping is similar to Fill Area 3D. See Surfaces - General Attributes.

PEXlib does not supply a set of type definitions for spheres due to the large number of combinations of vertex data possible when considering both the required and optional vertex data. Therefore, you may find it convenient to design your own data structure to pass in the spheres parameter when using the PEXDataPacked data model. You need to design the data structure with the following ordering rules in mind:

The required order is:

   PEXCoord center
     PEXColor*      one of the PEXlib color types, if provided
     float          radius
     float[n]       floating point data, if provided

As an example, if you wish to supply data for spheres using coordinates, RGB floating-point colors, and a radius, you would create a structure like this:

   typedef struct {
     PEXCoord         center;
     PEXColorRGB      rgb;
     float            radius;
   } MY_PEXRGBSphereVertex;

Remember to set the correct surface vertex attributes in the OCC. In this case you would make sure that the PEXGAColor flag is on and the PEXGARadius flag is on. You set the color_type field in the OCC to PEXColorTypeRGB.

If you are using the PEXDataStride data model, then you set the stride and offset members in the OC Context to reflect the way the data is stored in your structured array. Pass a pointer to the start of the structured array in the spheres argument of the function call. Be sure that there is a valid offset for each vertex attribute that is present.

If you are using the PEXDataUnpacked data model, then you would set size members in the OCC to the appropriate values and point to each of the data lists with the PEXUnpackedVertexData. Again, be careful to set a size and pointer for every attribute you indicate as present in the vertex attributes.

Errors

BadPEXRenderer
The specified renderer resource identifier is invalid.

BadPEXStructure
The specified structure resource identifier is invalid.

See Also

For primitives similar to this one, see: PEXOCCCones.

There are no PEXlib 5.1 compatibility primitives similar to this one.

For attributes that affect this primitive, see

For an overview, see Output Command Functions.