logoThe Lightwave3D Object Access Pluginlogo


This "Global Class" plugin provides the plugin programmer with access to any object's point, polygon, and surface data. Given an object's file name, the plugin will load that object from disk, and supply points and polygons as requested. When this plugin is activated by calling Lightwave3D's global function with the string "LWObjectAccess", it returns an ObjectAccess structure with the following elements:

LWObjectID (*create)(char *name)
This function reads an object file specified into memory, and returns its ID, or NULL on failure.
void (*destroy)(LWObjectID obj)
This function should be called to free objects when they're no longer needed.
int (*pointCount)(LWObjectID obj)
Return the number of points in the object.
int (*polyCount)(LWObjectID obj);
Return the number of polygons in the object.
int (*surfCount)(LWObjectID obj)
Return the number of surfaces in the object.
LWPointID (*pointGet)(LWObjectID obj, int index)
Return the address of a (read-only) LWPoint structure.
LWPolygonID (*polyGet)(LWObjectID obj, int index)
Return the address of a (read-only) LWPolygon structure.
LWSurfaceID (*surfGet)(LWObjectID obj, int index)
Return the address of a (read-only) LWSurface structure. Note that LWSurface.data, which points to a chunk of texture data, may be NULL if there was no SURF chunk in the object corresponding to that name entry in the SRFS chunk. Check the size before trying to use the texture data.
double (*boundBox)(LWObjectID obj, double *bounds)
Returns the maximum value of R ( = sqrt(x*x+y*y+z*z) ) for any point, and fills bounds[6] with xmin,xmax,ymin,ymax,zmin,zmax. This structure, and the point, polygon, and surface structures are defined in lwobjacc.h, which should be #include'd in any program which will use this plugin.

A new addition to the ObjectAccess plugin is the ObjectHelp module, which provides some handy functions for working with LWObjects and surfaces. This plugin is activated by calling Lightwave3D's global function with the string "LWObjectHelp", it returns an ObjectHelp structure with the following elements:

void (*polyNormal)(ObjectAccess *, LWObjectID, LWPolygon *,LWPoint *)
Fill the LWPoint structure with the polygon's normal vector.
LWPoint *(*createNormals)(ObjectAccess *, LWObjectID)
Allocate and fill an array of face and vertex normals. The array
has one LWPoint for each point in the object, which is the vertex-normal for the corresponding point. The vertex normals are followed by one LWPoint for each polygon, containing the face normals.
You must free() the memory allocated by this function yourself!
LWUV *(*createUVs)(ObjectAccess *, LWObjectID, LWPoint *, LWTexture *)
Allocate and fill an array of LWUV's. These values will not necessarily be between 0.0 and 1.0, so you may need to take only the fractional part.
You must free() the memory allocated by this function yourself!
int (*getSurfAttr)(LWSurfaceID, surfAttr *)
Fill surfAttr, return SURF bytes read.
void (*getTextureUV)(LWTexture *,LWPoint *,LWUV *,LWPoint *)
Fill LWUV , args: tx,spot,uv,norm set axis for TT_CUBIC per poly.

Get the Lightwave3D Object Geometry Access Plugin for: