Surface

ILxSurfaceItem

class ILxSurfaceItem

Public Functions

LxResult GetSurface(LXtObjectID self, LXtObjectID chanRead, unsigned morph, void **ppvObj)

All item types that produce a surface can be queried for their ILxSurfaceItem interface.

  • GetSurface returns the ILxSurface object, ‘morph’ should be set if the client is intertested in the morphed surface.

  • Prepare adds the channels for the surface modifier and

  • Evaluate evaluates the surface.

LxResult Prepare(LXtObjectID self, LXtObjectID eval, unsigned *index)
LxResult Evaluate(LXtObjectID self, LXtObjectID attr, unsigned index, void **ppvObj)
bool AllocSurf(ILxUnknownID chanRead, bool morph, CLxLoc_Surface &surf)

User Class Only:

bool AllocSurf(ILxUnknownID attr, unsigned index, CLxLoc_Surface &surf)

LXtRayInfo

struct st_LXtRayInfo

Surface objects have a number of properties that can be queried with the ILxBinnedSurface interface.

  • GetBBox returns the surface bounding box.

  • FrontBBox sets the front bounding box for that bin. The ‘front’ bounding box is formed by the geometry facing the viewer given by its position and direction vectors.

  • RayCast casts a ray on the surface.

The input is the rayInfo structure which holds the position & direction of the ray plus some optional settings. ‘cull’ must be true to cull hidden geometry, ‘half’ only raycasts the geoemtry in front of the viewer and ‘vmapName’ must be set to calculate the UVs (or other vmap values) at the hit point.

Public Members

LXtVector pos
LXtVector dir
unsigned cull
unsigned half
const char *vmapName
LXtID4 vmapType

LXtRayHit

struct st_LXtRayHit

The output is the rayHIt stucture. pos & nrm are the position and normal vectors at the hit point. ‘dist’ is the distance along the ray, ‘uvw’ are the vmap values if ‘vmap’ is set in the input and ‘bin’ is the hit bin.

Public Members

LXtVector pos
LXtVector nrm
LXtVector uvw
double dist
void *bin
LXtPolygonID polygon

ILxSurface

class ILxSurface

Public Functions

LxResult GetBBox(LXtObjectID self, LXtBBox *bbox)

  • BinCount returns the number of bins on a surface.

  • BinByIndex returns the ILxSurfaceBin object by its index in the surface.

  • TagCount returns the number of string tags per tag type

  • TagByIndex returns the string tag interface given by its type and index in the list.

  • GLCount returns the number of GL polygons displayed by the surface.

LxResult FrontBBox(LXtObjectID self, const LXtVector pos, const LXtVector dir, LXtBBox *bbox)
LxResult RayCast(LXtObjectID self, const LXtRayInfo *ray, LXtRayHit *hit)
LxResult BinCount(LXtObjectID self, unsigned int *count)
LxResult BinByIndex(LXtObjectID self, unsigned int index, void **ppvObj)
LxResult TagCount(LXtObjectID self, LXtID4 type, unsigned int *count)
LxResult TagByIndex(LXtObjectID self, LXtID4 type, unsigned int index, const char **stag)
LxResult GLCount(LXtObjectID self, unsigned int *count)
bool GetBin(unsigned index, CLxLoc_SurfaceBin &bin)

User Class Only:

ILxSurfaceBin

class ILxSurfaceBin

Public Functions

LxResult GetBBox(LXtObjectID self, LXtBBox *bbox)

Finally we have surface bins which represents a segment of the surface with the same tags and thus the same shader.

  • GetBBox sets the bounding box for that bin

  • FrontBBox sets the front bounding box for that bin. The ‘front’ bounding box is formed by the geometry facing the viewer given by its position and direction vectors. The surface bin object should also present an ILxStringTags interface to get the polygon tags on the bin for shader tree masking, and an ILxTableauSurface interface to allow the surface to be sampled into a triangle soup.

LxResult FrontBBox(LXtObjectID self, const LXtVector pos, const LXtVector dir, LXtBBox *bbox)

ILxCurveGroup

class ILxCurveGroup

Items declare that they can provide curves with a package tag giving the name of the curve channel. Read in an evaluated context, this will be an ValueReference object channel holding the curve group object.

Public Functions

LxResult GetBBox(LXtObjectID self, LXtBBox *bbox)

Any item can present itself as a group of curves. The bounding box and count of curves can be read from the root object, and curve accessors can be allocated for each one by index.

LxResult Count(LXtObjectID self, unsigned *count)
LxResult ByIndex(LXtObjectID self, unsigned index, void **ppvObj)

ILxCurve

class ILxCurve

Items declare that they can provide curves with a package tag giving the name of the curve channel. Read in an evaluated context, this will be an ValueReference object channel holding the curve group object.

Public Functions

LxResult GetBBox(LXtObjectID self, LXtBBox *bbox)

The curve accessor allows the client to read the attributes and shape of the curve. It also has StringTag interface for bin tags. The bounding box and length are gross features.

double Length(LXtObjectID self)
LxResult SplineCount(LXtObjectID self, unsigned *count)

If the curve is piecewise cubic, the spline segments can be read as Bezier control points. If the curve is not a spline then Count() returns NOTFOUND.

LxResult SplineByIndex(LXtObjectID self, unsigned index, LXtVector b0, LXtVector b1, LXtVector b2, LXtVector b3)
LxResult SplineLengthByIndex(LXtObjectID self, unsigned index, double *length)
unsigned BendCount(LXtObjectID self)

Curves can also be parameteric. In that case they aren’t made of splines, but we want to know aproximately how many bends they have in case we need to sample it and capture the shape. A bend is a flex in the curve, and we’re counting how many of them there are relative to the parameterization. For piecewise cubic curves this is twice the number of splines.

double Param(LXtObjectID self)

Points along the curve are read by setting the parameter for the curve to a value between 0 and 1. The parameter can also be set by the fraction of the curve’s total length.

LxResult SetParam(LXtObjectID self, double param)
double LenFraction(LXtObjectID self)
LxResult SetLenFraction(LXtObjectID self, double frac)
LxResult Position(LXtObjectID self, LXtVector pos)

The position, tangent, and curvature can then be read. The position is in world coordinates, the tangent is the rate of change relative to the parameter, and the curvature is the tangent’s rate of change relative to the parameter.

LxResult Tangent(LXtObjectID self, LXtVector tan)
LxResult Curvature(LXtObjectID self, double *curv)
LxResult Normal(LXtObjectID self, LXtVector normal)

The normal of the curve can also be computed. This should always be a vector at 90 degrees to the tangent.

LxResult MeshNormal(LXtObjectID self, LXtObjectID meshObj, LXtMatrix4 xfrm, LXtVector normal)

Normals can also be computed using the closest polygon normal from a given mesh, or the direction to the closest point on another curve.

LxResult GuideCurveNormal(LXtObjectID self, LXtObjectID other, LXtVector normal)
LxResult Closest(LXtObjectID self, const LXtVector probe, double *param, LXtVector pos, LXtVector norm)

This finds the closest point on the curve at the probe position. Results are returned as the parameter value, the position on the curve, and the normal to the curve in the direction of the probe.

LxResult IsClosed(LXtObjectID self)

This returns LXe_TRUE or LXe_FALSE, depending on whether the curve is closed or not.

LxResult WalkByAngle(LXtObjectID self, double start, double end, double angle, LXtObjectID visitor)

Sometimes, it can be useful to walk a curve from a start point to an end point, based on an angle. Samples will be placed along the curve where the angle deviation from the last sample is greater than the threshold angle.

  • LXsPKG_CURVES_CHANNEL

ILxCurve1

class ILxCurve1

Public Functions

LxResult GetBBox(LXtObjectID self, LXtBBox *bbox)

This interface was retired in modo 901, and was replaced with an updated one that added a few more methods.

double Length(LXtObjectID self)
LxResult SplineCount(LXtObjectID self, unsigned *count)
LxResult SplineByIndex(LXtObjectID self, unsigned index, LXtVector b0, LXtVector b1, LXtVector b2, LXtVector b3)
unsigned BendCount(LXtObjectID self)
double Param(LXtObjectID self)
LxResult SetParam(LXtObjectID self, double param)
LxResult SetLenFraction(LXtObjectID self, double frac)
LxResult Position(LXtObjectID self, LXtVector pos)
LxResult Tangent(LXtObjectID self, LXtVector tan)
LxResult Closest(LXtObjectID self, const LXtVector probe, double *param, LXtVector pos, LXtVector norm)

ILxCurve2

class ILxCurve2

Public Functions

LxResult GetBBox(LXtObjectID self, LXtBBox *bbox)

This interface was retired in modo 10, and was replaced with an updated one that added a few more methods.

double Length(LXtObjectID self)
LxResult SplineCount(LXtObjectID self, unsigned *count)
LxResult SplineByIndex(LXtObjectID self, unsigned index, LXtVector b0, LXtVector b1, LXtVector b2, LXtVector b3)
unsigned BendCount(LXtObjectID self)
double Param(LXtObjectID self)
LxResult SetParam(LXtObjectID self, double param)
double LenFraction(LXtObjectID self)
LxResult SetLenFraction(LXtObjectID self, double frac)
LxResult Position(LXtObjectID self, LXtVector pos)
LxResult Tangent(LXtObjectID self, LXtVector tan)
LxResult Closest(LXtObjectID self, const LXtVector probe, double *param, LXtVector pos, LXtVector norm)
LxResult IsClosed(LXtObjectID self)

ILxCurve3

class ILxCurve3

Public Functions

LxResult GetBBox(LXtObjectID self, LXtBBox *bbox)

This interface was retired in modo 13, and was replaced with an updated one that added a few more methods.

double Length(LXtObjectID self)
LxResult SplineCount(LXtObjectID self, unsigned *count)
LxResult SplineByIndex(LXtObjectID self, unsigned index, LXtVector b0, LXtVector b1, LXtVector b2, LXtVector b3)
unsigned BendCount(LXtObjectID self)
double Param(LXtObjectID self)
LxResult SetParam(LXtObjectID self, double param)
double LenFraction(LXtObjectID self)
LxResult SetLenFraction(LXtObjectID self, double frac)
LxResult Position(LXtObjectID self, LXtVector pos)
LxResult Tangent(LXtObjectID self, LXtVector tan)
LxResult Closest(LXtObjectID self, const LXtVector probe, double *param, LXtVector pos, LXtVector norm)
LxResult IsClosed(LXtObjectID self)
LxResult WalkByAngle(LXtObjectID self, double start, double end, double angle, LXtObjectID visitor)