vertex (lx_vertex.hpp)

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


Vertex Features

A vertex is a general concept spanning meshes, render surfaces, and particle simulation. A vertex is a point in a multi-dimensional space. Vertex features are named vectors describing aspects of the vertex. A vertex vector is the concatenation of the values of all of its features into a single array. A vertex description (also TableauVertex) lists the features of the vertex and their offset in the vertex vector.

Vertex feature categories indicate the context where the feature is expected to be valid. Currently that just surfaces and particles.

(1) SDK: Declarations
 #define LXsVFCAT_SURFACE        "surface"
 #define LXsVFCAT_PARTICLE       "particle"

A vector type can in theory be any string of unique character codes, but these are the most common and most likely supported.

(2) SDK: Declarations
 #define LXsVECTYPE_XY           "XY"
 #define LXsVECTYPE_XYZ          "XYZ"
 #define LXsVECTYPE_RGB          "RGB"
 #define LXsVECTYPE_RGBA         "RGBA"
 #define LXsVECTYPE_UV           "UV"
 #define LXsVECTYPE_UVW          "UVW"

Tableau Vertex

A tableau vertex object encodes information about the structure of the vertex data for sampling elements. Shaders and the renderer negotiate for the features they want from the element. These are added to the vertex object and are given offsets into the master vector. Once set, the vector can be queried for its total size, and for the offsets of each of the selected vertex features.

(3) SDK: ILxTableauVertex interface
         LXxMETHOD(  LxResult,
 AddFeature) (
         LXtObjectID              self,
         LXtID4                   type,
         const char              *name,
         unsigned int            *index);
 
         LXxMETHOD(  LxResult,
 Lookup) (
         LXtObjectID              self,
         LXtID4                   type,
         const char              *name,
         unsigned int            *offset);
 
         LXxMETHOD(  unsigned int,
 Size) (
         LXtObjectID              self);
 
         LXxMETHOD(  unsigned int,
 Count) (
         LXtObjectID              self);
 
         LXxMETHOD(  LxResult,
 ByIndex) (
         LXtObjectID              self,
         unsigned int             index,
         LXtID4                  *type,
         const char             **name,
         unsigned int            *offset);

(4) User Class: TableauVertex method
         int
 NewFeature (
         LXtID4                   type,
         const char              *name)
 {
         unsigned                 index;
         LxResult                 rc;
 
         rc = AddFeature (type, name, &index);
         if (LXx_OK (rc))
                 return index;
         else
                 return -1;
 }

(5) User Class: TableauVertex method
         int
 GetOffset (
         LXtID4                   type,
         const char              *name)
 {
         unsigned                 offset;
         LxResult                 rc;
 
         rc = Lookup (type, name, &offset);
         if (LXx_OK (rc))
                 return offset;
         else
                 return -1;
 }

(6) SDK: Declarations
 #define LXu_TABLEAUVERTEX       "F90A0A39-EE2A-4D11-912B-9338EF271DFF"

Empty TableauVertex Python user class.

(7) PY: TableauVertex method
 pass

Service

The vertex feature service provides methods for interrogating features.

(8) SDK: Declarations
 #define LXa_VERTEXFEATURESERVICE        "vertexfeatureservice"
 #define LXu_VERTEXFEATURESERVICE        "B40D51A9-6C04-46D1-BA8A-0FE9B32EAC3C"

(9) SDK: ILxVertexFeatureService interface
         LXxMETHOD(  LxResult,
 ScriptQuery) (
         LXtObjectID              self,
         void                   **ppvObj);

Get a new, empty TableauVertex object.

(10) SDK: ILxVertexFeatureService interface
         LXxMETHOD(  LxResult,
 AllocVertex) (
         LXtObjectID              self,
         void                   **ppvObj);

This gets the ident string for a vertex feature given the type and (optional) name.

(11) SDK: ILxVertexFeatureService interface
         LXxMETHOD(  LxResult,
 Lookup) (
         LXtObjectID              self,
         LXtID4                   type,
         const char              *name,
         const char             **ident);

Given the ident the various attributes of the feature can be read.

(12) SDK: ILxVertexFeatureService interface
         LXxMETHOD(  LxResult,
 Type) (
         LXtObjectID              self,
         const char              *ident,
         LXtID4                  *type);
 
         LXxMETHOD(  LxResult,
 Name) (
         LXtObjectID              self,
         const char              *ident,
         const char             **name);
 
         LXxMETHOD(  LxResult,
 Dimension) (
         LXtObjectID              self,
         const char              *ident,
         unsigned                *dimension);
 
         LXxMETHOD(  LxResult,
 VectorType) (
         LXtObjectID              self,
         const char              *ident,
         const char             **vecType);
 
         LXxMETHOD(  LxResult,
 DataType) (
         LXtObjectID              self,
         const char              *ident,
         const char             **typeName);
 
         LXxMETHOD(  LxResult,
 TestCategory) (
         LXtObjectID              self,
         const char              *ident,
         const char              *category);

(13) User Service Class: VertexFeatureService method

Empty vertes service Python user class.

(14) PY: VertexFeatureService method
 pass

Feature Packages

For some subset of features we define packages. If an item type wants to be able to use a package it should set this server tag to the feature category.

(15) SDK: Declarations
 #define LXsPKG_USEFEATURES      "package.useFeatures"

These packages have names that are derived from the ident and the read-only flag.