rendercache (lx_rendercache.hpp)

From The Foundry MODO SDK wiki
Jump to: navigation, search
There are security restrictions on this page


Contents

RenderCache SDK ILxRenderCacheService

(1) SDK: Declarations
 #define LXu_RENDERCACHESERVICE  "138FF638-1E34-4CC6-BAFC-4F734969F47E"
 #define LXa_RENDERCACHESERVICE  "rendercacheservice"

Create render cache. Caller can pass LXiRENDERCACHE_XXX flags to guide the cache initialization.

(2) SDK: ILxRenderCacheService interface
         LXxMETHOD ( LxResult,
 CreateRenderCache) (
         LXtObjectID       self,
         void            **ppvObj,
         unsigned int      createFlags);

(3) User Service Class: RenderCacheService method
         bool
 NewRenderCache (
         CLxLoc_RenderCache      &rcache,
         unsigned                 createFlags)
 {
         LXtObjectID             obj;
 
         if (LXx_FAIL (CreateRenderCache (&obj, createFlags)))
                 return false;
 
         return rcache.take (obj);
 }

RenderCache SDK ILxRenderCache

(4) SDK: Declarations

Return current render cache time and time offsets (for motion blur). Argument timeOffsets is an array of 2 double values.

(5) SDK: ILxRenderCache interface
         LXxMETHOD ( void,
 Time) (
         LXtObjectID      self,
         double          *time,
         double          *timeOffsets);

Update render cache to given time. If render cache is created without LXfRENDERCACHE_TURN_OFF_AUTO_UPDATES flag, the method will return LXe_FAILED. If time is the same as internal time no update will happen. In that case specify the force to force the full render cache update.

(6) SDK: ILxRenderCache interface
         LXxMETHOD ( LxResult,
 Update) (
         LXtObjectID      self,
         double           time,
         int              force);

Clear the render cache.

(7) SDK: ILxRenderCache interface
         LXxMETHOD ( void,
 Clear) (
         LXtObjectID      self);

Return number of geo cache surfaces.

(8) SDK: ILxRenderCache interface
         LXxMETHOD ( LxResult,
 GeoSurfaceCount) (
         LXtObjectID      self,
         int             *count);

Get geo cache surface at given index.

(9) SDK: ILxRenderCache interface
         LXxMETHOD ( LxResult,
 GeoSurfaceAt) (
         LXtObjectID       self,
         int               index,
         void            **srf);

(10) User Class: RenderCache method
         bool
 GetGeoSurface (
         int             index,
 CLxLoc_GeoCacheSurface  &srf)
 {
         LXtObjectID     obj;
 
         if (LXx_FAIL (GeoSurfaceAt (index, &obj)))
                 return false;
 
         return srf.set (obj);
 }

(11) SDK: Declarations
 #define LXu_RENDERCACHE "1ED14AD3-B202-46FF-A720-A1DCFC0B893A"
 #define LXa_RENDERCACHE "rendercache"

RenderCache SDK ILxRenderCacheListener

(12) SDK: Declarations
 #define LXu_RENDERCACHELISTENER "E1EBCD71-B28A-42FB-9AF7-FADA18FEBFC6"

Called when render cache is being destroyed. This happens when user changes the current scene (if LXfRENDERCACHE_TRACK_CURRENT_SCENE was specified).

(13) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 RenderCacheDestroy) (
         LXtObjectID             self);

(14) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 UpdateBegin) (
         LXtObjectID             self);

(15) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 UpdateEnd) (
         LXtObjectID             self);

Called after the geo surface has been added to cache.

(16) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 GeoCacheSurfaceAdd )(
         LXtObjectID             self,
         LXtObjectID             geoSrf);

Called before the geo surface has been removed from cache.

(17) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 GeoCacheSurfaceRemove )(
         LXtObjectID             self,
         LXtObjectID             geoSrf);

Called when the geo surface data has been changed (this method is called only for non-instanced surfaces).

(18) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 GeoCacheSurfaceGeoUpdate )(
         LXtObjectID             self,
         LXtObjectID             geoSrf);

Called when the xform data has been changed.

(19) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 GeoCacheSurfaceXformUpdate )(
         LXtObjectID             self,
         LXtObjectID             geoSrf);

Called when the shading data has been changed.

(20) SDK: ILxRenderCacheListener interface
         LXxMETHOD (void,
 GeoCacheSurfaceShaderUpdate )(
         LXtObjectID             self,
         LXtObjectID             geoSrf);

RenderCache SDK ILxGeoCacheSegment

Return the segment's bounding box in the world-space.

(21) SDK: ILxGeoCacheSegment interface
         LXxMETHOD ( LxResult,
 GetBBox ) (
         LXtObjectID              self,
         LXtBBox                 *bbox);

(22) SDK: ILxGeoCacheSegment interface
         LXxMETHOD ( void,
 PolygonCount) (
         LXtObjectID              self,
         int                     *count);

(23) SDK: ILxGeoCacheSegment interface
         LXxMETHOD ( void,
 VertexCount) (
         LXtObjectID              self,
         int                     *count);

All polygons in the segments have same number of vertices in the polygon. It can be 3 for triangles, 2 for curves and (hair & fur) and 1 for particles.

(24) SDK: ILxGeoCacheSegment interface
         LXxMETHOD ( void,
 VertsPerPoly) (
         LXtObjectID              self,
         int                     *count);

Return if the vertex feature is stored in the segment. OPOS and ONRM are always stored. The count for WVEL, RAD and FUR will be either 0 or 1. For UV, DPDU and DPDV the count will return how many UV vmaps are stored in the segment.

(25) SDK: ILxGeoCacheSegment interface
         LXxMETHOD ( void,
 VertexFeatureCount) (
         LXtObjectID              self,
         int                      feature,
         int                     *count);

Segment vertex feature is copied per-polygon-per-vertex into client's memory (like a triangle soup). Caller can specify the start offset into the segment's data. The start and count are in number of elements which are from 0 to VertsPerPoly * PolygonCount (not in byte size).

(26) SDK: ILxGeoCacheSegment interface
         LXxMETHOD ( LxResult,
 GetPolygonVertexFeature) (
         LXtObjectID              self,
         int                      feature,
         void                    *featureData,
         int                      count,
         int                      start);

Segment vertex feature is copied per-vertex into client's memory. Caller can specify the start offset into the segment's data. The start and count are in number of elements which are from 0 to VertexCount (not in byte size).

(27) SDK: ILxGeoCacheSegment interface
         LXxMETHOD ( LxResult,
 GetVertexFeature) (
         LXtObjectID              self,
         int                      feature,
         void                    *featureData,
         int                      count,
         int                      start);

Copy polygon vertex indices into client's memory. Caller can specify the start offset into the segment's data. The start and count are in number of elements which are from 0 to VertsPerPoly * PolygonVertexCount (not in byte size).

(28) SDK: ILxGeoCacheSegment interface
         LXxMETHOD (LxResult,
 GetPolygonVertexInds) (
         LXtObjectID              self,
         int                     *polyVertexInds,
         int                      count,
         int                      start);

(29) User Class: GeoCacheSegment method

(30) SDK: Declarations
 #define LXu_GEOCACHESEGMENT     "CDA6EDAD-8E71-4EA9-A05A-326CEAD7DE9B"
 #define LXa_GEOCACHESEGMENT     "rendercachegeosegment"

RenderCache SDK ILxGeoCacheSurface

(31) SDK: Declarations
 #define LXiRENDERCACHE_GEOVERT_OPOS             0               // Object-space position (LXtFVector)
 #define LXiRENDERCACHE_GEOVERT_ONRM             1               // Object-space normal (LXtFVector)
 #define LXiRENDERCACHE_GEOVERT_OVEL             2               // Object-space velocity (LXtFVector)
 #define LXiRENDERCACHE_GEOVERT_RAD              3               // Vertex radius (float)
 #define LXiRENDERCACHE_GEOVERT_FUR              4               // Fur params (LXtFVector [U, V(=lenParm), id])
 
 #define LXiRENDERCACHE_GEOVERT_UV               0x100           // Vertex UV coords. (LXtFVector2)
 #define LXiRENDERCACHE_GEOVERT_DPDU             0x200           // Vertex UV derivatives (LXtFVector3)
 #define LXiRENDERCACHE_GEOVERT_DPDV             0x300           // Vertex UV derivatives (LXtFVector3)

Surface visibility flags

(32) SDK: LXtGeoCacheSrfVisibility struct
 unsigned        camera          : 1;
 unsigned        indirect        : 1;
 unsigned        reflection      : 1;
 unsigned        refraction      : 1;
 unsigned        subscatter      : 1;
 unsigned        occlusion       : 1;

Obtain geo surface shader mask name (for example Surf(ShaderMaskName)).

(33) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 ShaderMaskName) (
         LXtObjectID               self,
         const char              **name);

Returns one of LXi_SURF_XXX flags.

(34) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( int,
 ShaderMaskType) (
         LXtObjectID              self);

Every surface has a source item. For replicated and instanced surfaces this method will return the source mesh.

(35) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 SourceItem) (
         LXtObjectID               self,
         void                    **ppvObj);

Returns 1 if surface is instanced.

(36) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( int,
 IsInstanced) (
         LXtObjectID               self);

Returns surface instance index, if surface is not instanced the returned value is -1.

(37) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( int,
 InstanceIndex) (
         LXtObjectID               self);

If geo surface is instanced then it doesn't contain any geometry segments. This mehtod returns the source geo cache surface which contains the segment data.

(38) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 SourceSurface) (
         LXtObjectID               self,
         void                    **ppvObj);

Obtain surface's bounding box.

(39) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 GetBBox) (
         LXtObjectID              self,
         LXtBBox                 *bbox);

Return surface's xform information at given time endpoint (T0 or T1). T0 (=0) is time for shutter open, T1 (=1) is time for shutter close.

(40) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 GetXfrm) (
         LXtObjectID               self,
         LXtVector                 pos,
         LXtMatrix                 rot,
         LXtVector                 scl,
         int                               endpoint);

Return how many segments are in this surface.

(41) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( void,
 SegmentCount) (
         LXtObjectID              self,
         int                     *count);

Return how many polygons are in this surface.

(42) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( void,
 PolygonCount) (
         LXtObjectID              self,
         int                     *count);

Return how many vertices are in this surface.

(43) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( void,
 VertexCount) (
         LXtObjectID              self,
         int                     *count);

Get segment by index

(44) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 SegmentAt) (
         LXtObjectID               self,
         int                       index,
         void                    **segment);

Return surface visibility flags (visible in camera, etc.)

(45) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 VisibilityFlags) (
         LXtObjectID                      self,
         LXtGeoCacheSrfVisibility        *flags);

Return surface unique id.

(46) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( int,
 ID) (
         LXtObjectID               self);

Return if surface is valid, i.e. not deleted.

(47) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( int,
 IsValid) (
         LXtObjectID               self);

Populate geometry segments with vertices and polygons. If surface is already populated this method will do nothing. Use this method when you want to populate geometry cache on-demand.

(48) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 LoadSegments) (
         LXtObjectID               self);

(49) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( LxResult,
 UnloadSegments) (
         LXtObjectID               self);

Return ILxTableauVertexID which can be used to query vertex information.

(50) SDK: ILxGeoCacheSurface interface
         LXxMETHOD ( ILxTableauVertexID,
 GetVertexDesc )(
         LXtObjectID               self);

(51) SDK: ILxGeoCacheSurface interface
         LXxMETHOD (const char*,
 MaterialPTag ) (
         LXtObjectID               self);

(52) SDK: ILxGeoCacheSurface interface
         LXxMETHOD (const char*,
 PartPTag ) (
         LXtObjectID               self);

(53) SDK: ILxGeoCacheSurface interface
         LXxMETHOD (const char*,
 PickPTag ) (
         LXtObjectID               self);

(54) User Class: GeoCacheSurface method
         bool
 GetSourceItem (
         CLxLoc_Item     &item)
 {
         LXtObjectID             obj;
 
         if (LXx_FAIL (SourceItem (&obj)))
                 return false;
 
         return item.set (obj);
 }

(55) User Class: GeoCacheSurface method
         bool
 GetSourceSurface (
         CLxLoc_GeoCacheSurface  &srf)
 {
         LXtObjectID             obj;
 
         if (LXx_FAIL (SourceSurface (&obj)))
                 return false;
 
         return srf.set (obj);
 }

(56) User Class: GeoCacheSurface method
         bool
 GetSegment (
         int                     index,
         CLxLoc_GeoCacheSegment  &seg)
 {
         LXtObjectID             obj;
 
         if (LXx_FAIL (SegmentAt (index, &obj)))
                 return false;
 
         return seg.set (obj);
 }

(57) SDK: Declarations
 #define LXu_GEOCACHESURFACE     "770BD566-315B-4EEC-A2A5-266D122D8DDF"
 #define LXa_GEOCACHESURFACE     "rendercachegeosurface"