#include <slo.h>
Slo_SetPath(path) char *path;
int Slo_SetShader(name) char *name;
char *Slo_GetName()
SLO_TYPE Slo_GetType()
int Slo_GetNArgs()
SLO_VISSYMDEF *Slo_GetArgById(id) int id;
SLO_VISSYMDEF *Slo_GetArgByName(name) char *name;
Slo_EndShader()
char *Slo_TypetoStr(type) SLO_TYPE type;
char *Slo_StortoStr(storage) SLO_STORAGE storage;
char *Slo_DetailtoStr(detail) SLO_DETAIL detail;
Slo_SetPath sets the colon-delimited search path used to locate compiled shaders. The routine returns 0 on success, -1 with errno set if unable to do so.
Slo_SetShader attempts to locate and read the specified shader (in compiled format) using the same search path used by the renderer. It returns 0 if successful making the specified shader the current shader. It returns -1 on error with the global variable errno set to indicate the error condition.
Slo_GetName returns a pointer to a null terminated ascii string containing the name of the current shader. (This storage for the string name is freed when a new shader is made current or Slo_EndShader is executed.)
Slo_GetType returns the type of the current shader, where type is one of the following:
SLO_TYPE_SURFACE surface shader
SLO_TYPE_LIGHT light shader
SLO_TYPE_VOLUME volume shader
SLO_TYPE_DISPLACEMENT displacement shader
SLO_TYPE_TRANSFORMATION transformation shader
SLO_TYPE_IMAGER imager shader
Slo_GetNArgs returns the number of arguments accepted by the current shader.
Slo_GetArgByName, and Slo_GetArgById each return a pointer to an object with the following structure containing the visible fields of a shader symbol definition:
typedef struct slovissymdef {
char *svd_name; /* name of symbol */
SLO_TYPE svd_type; /* symbol type */
SLO_STORAGE svd_storage; /* symbol storage class */
SLO_DETAIL svd_detail; /* symbol variance */
char *svd_spacename; /* name of space in which */
/* to interpret symbol's value */
union {
POINT *pointval; /* pointers to default value */
SCALAR *scalarval;
char *stringval;
} svd_default;
} SLO_VISSYMDEF;
The members of this structure are:
SLO_TYPE_POINT three floating point values
SLO_TYPE_COLOR three floating point values
SLO_TYPE_SCALAR one floating point value
SLO_TYPE_STRING null-terminated ascii string
SLO_DETAIL_VARYING symbol's value varies over a geometric primitive
SLO_DETAIL_UNIFORM symbol's value is constant over a geometric primitive
The storage for this structure is static and must be copied elsewhere if its value is to be retained across calls. Slo_GetArgByName returns a pointer to a symbol definition based on the name parameter. Slo_GetArgById uses the argument id where id is an integer between 1 and the value returned by Slo_GetNArgs inclusive.
Slo_EndShader releases the storage used internally for the shader definition.
Slo_TypetoStr, Slo_StortoStr, and Slo_DetailtoStr return ascii representations of SLO_TYPE, SLO_STORAGE, and SLO_DETAIL values respectively.
/usr/local/prman/reyes/lib/shaders - standard shader definitions. /usr/local/prman/reyes/lib/libsloargs.a - sloargs library
Null pointer (0) returned by Slo_GetArgByName() and Slo_GetArgById() on error.
All information is contained in a static area so it must be copied if it is to be saved.