Globals: Object Info

LightWave

 
Multithreading Utilities Panels Globals Table of Contents

Object Info

Availability  LightWave 6.0 Component  Layout
Header  lwrender.h

The object info global returns functions for getting object-specific information about any of the objects in a scene. Use the Item Info global to get the object list and for generic item information. See also the Scene Objects global. The data returned by the object info functions is read-only, but you can use commands to set many of the parameters.

Global Call

   LWObjectInfo *objinfo;
   objinfo = global( LWOBJECTINFO_GLOBAL, GFUSE_TRANSIENT );
The global function returns a pointer to an LWObjectInfo.
   typedef struct st_LWObjectInfo {
      const char * (*filename)    (LWItemID);
      int          (*numPoints)   (LWItemID);
      int          (*numPolygons) (LWItemID);
      unsigned int (*shadowOpts)  (LWItemID);
      double       (*dissolve)    (LWItemID, LWTime);
      LWMeshInfoID (*meshInfo)    (LWItemID, int frozen);
      unsigned int (*flags)       (LWItemID);
      double       (*fog)         (LWItemID, LWTime);
      LWTextureID  (*dispMap)     (LWItemID);
      LWTextureID  (*clipMap)     (LWItemID);
      void         (*patchLevel)  (LWItemID, int *display, int *render);
      void         (*metaballRes) (LWItemID, double *display,
                                     double *render);
      LWItemID     (*boneSource)  (LWItemID);
      LWItemID     (*morphTarget) (LWItemID);
      double       (*morphAmount) (LWItemID, LWTime);
      unsigned int (*edgeOpts)    (LWItemID);
      void         (*edgeColor)   (LWItemID, LWTime, LWDVector color);
      int          (*subdivOrder) (LWItemID);
      double       (*polygonSize) (LWItemID, LWTime);
      int          (*excluded)    (LWItemID object, LWItemID light);
      void         (*matteColor)  (LWItemID, LWTime, LWDVector color);
      double       (*thickness)   (LWItemID, LWTime, int type);
      double       (*edgeZScale)  (LWItemID, LWTime);
   } LWObjectInfo;
name = filename( object )
Returns the filename for the object file. 

count = numPoints( object )
Returns the number of points in the object mesh.

count = numPolygons( object )
Returns the number of polygons in the object mesh. 

sopts = shadowOpts( object )
Returns bits for shadow options. 
LWOSHAD_SELF
LWOSHAD_CAST
LWOSHAD_RECEIVE
amount = dissolve( object, time )
Returns the object dissolve amount at the given time.

meshinfo = meshInfo( object, frozen )
Returns a mesh info structure for the object. This is a complete description of the object's geometry. See the Mesh Info page for a detailed discussion of mesh info structures. 

 

 

If frozen is true, the mesh for objects with subpatches and metaballs will contain the geometry that results from subdivision and isosurface calculation. The pntBasePos function will return the same point positions that Layout uses for object coordinate texture mapping. These are completely undeformed positions in the case of regular polygons and subpatches, and positions at freezing time for metaballs and partigons. pntOtherPos will return the actual world coordinates used by Layout. These should only be considered final if the mesh is obtained after all object transformations have been completed.

f = flags( object )
Returns the state of certain object settings as bits combined using bitwise-or. Possible flags are 
LWOBJF_UNSEEN_BY_CAMERA
LWOBJF_UNSEEN_BY_RAYS
LWOBJF_UNAFFECT_BY_FOG
LWOBJF_MORPH_MTSE
LWOBJF_MORPH_SURFACES
foglevel = fog( object, time )
Returns the amount by which the object is affected by fog.

texture = dispMap( object )
Returns the texture ID of the displacement image map applied to the object.

texture = clipMap( object )
Returns the texture ID of the clip map applied to the object.
 
patchLevel( object, display, render )
Returns the interface and render patch level for the object's subpatches.
 
metaballRes( object, display, render )
Returns the interface and render resolution of the object's metaballs.

boneobj = boneSource( object )
Returns the object whose bones are being used to deform the given object. (An object can be deformed by the bones of another object.)

morphobj = morphTarget( object )
Returns the morph target of the given object.

amount = morphAmount( object, time )
Returns the morph amount at a given time. If flags returns the LWOBJF_MORPH_MTSE bit, Multiple Target/Single Envelope morphing is enabled, and the morph amount includes an index into a chain of morph targets. Assume A's target is B, and B's target is C. Morph amounts between 0.0 and 1.0 morph A to B, while amounts between 1.0 and 2.0 morph A to C. The interpolant is the fractional part of the morph amount, and the index is the integer part.

options = edgeOpts( object )
Returns the object's edge rendering options, which can be any of the following combined using bitwise-or. 
LWEDGEF_SILHOUETTE
LWEDGEF_UNSHARED
LWEDGEF_CREASE
LWEDGEF_SURFACE
LWEDGEF_OTHER
Edge lines are drawn in the indicated areas. An unshared edge belongs to only one polygon. A crease is an edge where two polygons meet at an angle exceeding the max smoothing angle of the surface. A surface edge is where the polygons on either side have different surfaces.

LWEDGEF_SHRINK_DIST
The thickness of the lines is proportional to distance from the camera.
edgeColor( object, time, color )
The color used to render edges is written in the color argument.

index = subdivOrder( object )
Returns the subdivision order as a 0-based index into a list of options. 

 

 

0 - First
1 - After Morphing
2 - After Bones
3 - After Displacement
4 - After Motion
5 - Last
 

size = polygonSize( object, time )
Returns the polygon size setting. This is a scale factor with a default of 1.0.

state = excluded( object, light )
Returns true if the light is excluded from the object. Light exclusion is a user setting that prevents the light from affecting the rendering of the object.


matteColor(object,  time,  color)

The matte color set for the object is writen into the color argument.
thick = thickness(object,  time,  type)
Returns the thickness for the specified edge type, where type is one of the following:
LWTHICK_SILHOUETTE
LWTHICK_UNSHARED
LWTHICK_CREASE
LWTHICK_SURFACE
LWTHICK_OTHER
LWTHICK_LINE
LWTHICK_PARTICLE_HEAD
LWTHICK_PARTICLE_TAIL
zsc = edgeZScale(object,  time)
Returns the Edge Z Scale setting for edge rendering of object.

History

In LightWave 7.5, the  following functions and flags were added.

   matteColor
   thickness
   edgeZScale

   LWOBJF_UNSEEN_BY_ALPHA
   LWOBJF_MATTE
   LWOBJF_MORPH_SURFACES
Example

The scenscan, spreadsheet and unwrap SDK samples use the Object Info global.

The following code fragment collects information about the first object.

   #include <lwserver.h>
   #include <lwrender.h>

   LWItemInfo *iteminfo;
   LWObjectInfo *objinfo;
   LWItemID id;
   LWTime t = 3.0;          /* seconds */
   char *fname;
   int npoints, npols;
   unsigned int shopts;
   double dissolve;

   iteminfo = global( LWITEMINFO_GLOBAL, GFUSE_TRANSIENT );
   objinfo  = global( LWOBJECTINFO_GLOBAL, GFUSE_TRANSIENT );

   if ( iteminfo && objinfo ) {
      id = iteminfo->first( LWI_OBJECT, NULL );
      if ( id ) {
         fname    = objinfo->filename( id );
         npoints  = objinfo->numPoints( id );
         npols    = objinfo->numPolygons( id );
         shopts   = objinfo->shadowOpts( id );
         dissolve = objinfo->dissolve( id, t );
      }
   }