ayam.h File Reference

Main Ayam Header. More...

#include <limits.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <GL/glu.h>
#include <togl.h>
#include "aycore.h"
#include "nurbs.h"
#include "objects.h"
#include "contrib.h"

Go to the source code of this file.

Data Structures

struct  ay_point
 selected points More...
struct  ay_mpoint
 multiple points More...
struct  ay_pointedit
 point edit helper (ay_getpntcb callbacks fill it) More...
struct  ay_tag
 Tag, attach arbitrary information to objects. More...
struct  ay_btval
 binary tag value More...
struct  ay_trafo
 transformation attributes More...
struct  ay_object
 Ayam object. More...
struct  ay_list_object
 Ayam object list element. More...
struct  ay_shader_arg
 RenderMan shader parameter. More...
struct  ay_shader
 RenderMan shader. More...
struct  ay_mat_object
 Material Object. More...
struct  ay_riopt
 RenderMan interface options. More...
struct  ay_root_object
 Root object. More...
struct  ay_nurbcurve_object
 NURBS curve object. More...
struct  ay_stess_uvp
 a tesselated NURBS patch point More...
struct  ay_stess
 a complete tesselation More...
struct  ay_nurbpatch_object
 NURBS patch object. More...
struct  ay_pamesh_object
 PatchMesh object. More...
struct  ay_pomesh_object
 PolyMesh object. More...
struct  ay_sdmesh_object
 SubdivisionMesh object. More...
struct  ay_gordon_object
 Gordon object. More...
struct  ay_text_object
 Text object. More...
struct  ay_light_object
 Lightsource object. More...
struct  ay_level_object
 Level object. More...
struct  ay_box_object
 Box object. More...
struct  ay_bpatch_object
 Bilinear patch object. More...
struct  ay_sphere_object
 Sphere object. More...
struct  ay_cone_object
 Cone object. More...
struct  ay_disk_object
 Disk object. More...
struct  ay_cylinder_object
 Cylinder object. More...
struct  ay_hyperboloid_object
 Hyperboloid object. More...
struct  ay_paraboloid_object
 Paraboloid object. More...
struct  ay_torus_object
 Torus object. More...
struct  ay_icurve_object
 Interpolating curve object. More...
struct  ay_acurve_object
 Approximating curve object. More...
struct  ay_concatnc_object
 Concatenate curves object. More...
struct  ay_offnc_object
 Offset curves object. More...
struct  ay_cap_object
 Cap surface object. More...
struct  ay_bevel_object
 Bevel surface object. More...
struct  ay_clone_object
 Clone object. More...
struct  ay_camera_object
 Camera object. More...
struct  ay_riinc_object
 RenderMan Interface Bytestream include object. More...
struct  ay_riproc_object
 RenderMan Interface procedural object. More...
struct  ay_revolve_object
 Surface of revolution object. More...
struct  ay_extrude_object
 Extrusion surface object. More...
struct  ay_sweep_object
 Swept surface object. More...
struct  ay_swing_object
 Swung surface object. More...
struct  ay_birail1_object
 Birail surface object (from three curves). More...
struct  ay_birail2_object
 Birail surface object (from four curves). More...
struct  ay_skin_object
 Skinned surface object (Loft). More...
struct  ay_extrnc_object
 Extract curve from surface object. More...
struct  ay_extrnp_object
 Extract surface from surface object. More...
struct  ay_concatnp_object
 Concatenate surfaces object. More...
struct  ay_offnp_object
 Offset surface object. More...
struct  ay_ncircle_object
 Circle object. More...
struct  ay_script_object
 Script object. More...
struct  ay_view_object
 View object. More...
struct  ay_select_object
 Select object. More...
struct  ay_trim_object
 Trim surface object. More...
struct  ay_preferences
 User preferences. More...
struct  ay_ftable
 callback table More...

Defines

#define AYGLUCBTYPE
#define AY_POINTER   8
 size of arrows
#define AY_EPSILON   1.0e-06
 to avoid direct comparison of doubles with 0.0
#define AY_APTRAN4(v1, v2, m)   {v1[0]=v2[0]*m[0]+v2[1]*m[4]+v2[2]*m[8]+v2[3]*m[12];v1[1]=v2[0]*m[1]+v2[1]*m[5]+v2[2]*m[9]+v2[3]*m[13];v1[2]=v2[0]*m[2]+v2[1]*m[6]+v2[2]*m[10]+v2[3]*m[14];v1[3]=v2[0]*m[3]+v2[1]*m[7]+v2[2]*m[11]+v2[3]*m[15];}
 Apply 4x4 transformation matrix m to 3D point/vector in v2.
#define AY_APTRAN3(v1, v2, m)   {v1[0]=v2[0]*m[0]+v2[1]*m[4]+v2[2]*m[8]+1.0*m[12];v1[1]=v2[0]*m[1]+v2[1]*m[5]+v2[2]*m[9]+1.0*m[13];v1[2]=v2[0]*m[2]+v2[1]*m[6]+v2[2]*m[10]+1.0*m[14];}
 Apply 4x4 transformation matrix m to 3D point/vector in v2.
#define AY_M44(m, r, c)   ((m)[(c)*4+(r)])
 4x4 matrix element access
#define AY_ISTRAFO(o)
 is ay_object o transformed?
#define AY_CHTCLERRRET(stat, name, interp)
 check and report tcl error status, then return
#define AY_CHTCLERRGOT(stat, name, interp)
 check and report tcl error status, then jump to cleanup label
The Truth

#define AY_TRUE   1
#define AY_FALSE   0
Return/Error Codes

#define AY_OK   0
#define AY_EWARN   1
#define AY_ERROR   2
#define AY_EFLUSH   3
#define AY_EOUTPUT   4
#define AY_EOMEM   5
#define AY_EOPENFILE   10
#define AY_ECLOSEFILE   11
#define AY_EFORMAT   12
#define AY_EUEOF   13
#define AY_EEOF   14
#define AY_EDONOTLINK   15
#define AY_ENOSEL   20
#define AY_EARGS   21
#define AY_EOPT   22
#define AY_EUOPT   23
#define AY_EWTYPE   24
#define AY_ETYPE   30
#define AY_ENTYPE   31
#define AY_EREF   40
#define AY_ENULL   50
Object Type Ids

#define AY_IDROOT   0
#define AY_IDNPATCH   1
#define AY_IDNCURVE   2
#define AY_IDLEVEL   3
#define AY_IDLIGHT   4
#define AY_IDBOX   5
#define AY_IDBPATCH   6
#define AY_IDVIEW   7
#define AY_IDCAMERA   8
#define AY_IDINSTANCE   9
#define AY_IDSPHERE   10
#define AY_IDDISK   11
#define AY_IDCONE   12
#define AY_IDCYLINDER   13
#define AY_IDPARABOLOID   14
#define AY_IDHYPERBOLOID   15
#define AY_IDTORUS   16
#define AY_IDRIINC   17
#define AY_IDMATERIAL   18
#define AY_IDICURVE   19
#define AY_IDREVOLVE   20
#define AY_IDEXTRUDE   21
#define AY_IDSWEEP   22
#define AY_IDSKIN   23
#define AY_IDCAP   24
#define AY_IDPAMESH   25
#define AY_IDPOMESH   26
#define AY_IDCONCATNC   27
#define AY_IDCLONE   28
#define AY_IDSDMESH   29
#define AY_IDGORDON   30
#define AY_IDTEXT   31
#define AY_IDBIRAIL1   32
#define AY_IDBIRAIL2   33
#define AY_IDEXTRNC   34
#define AY_IDSCRIPT   35
#define AY_IDRIPROC   36
#define AY_IDBEVEL   37
#define AY_IDNCIRCLE   38
#define AY_IDSWING   39
#define AY_IDSELECT   40
#define AY_IDEXTRNP   41
#define AY_IDOFFNC   42
#define AY_IDACURVE   43
#define AY_IDTRIM   44
#define AY_IDCONCATNP   45
#define AY_IDOFFNP   46
#define AY_IDLAST   50
Level Object SubType Ids

#define AY_LTEND   0
#define AY_LTLEVEL   1
#define AY_LTUNION   2
#define AY_LTDIFF   3
#define AY_LTINT   4
#define AY_LTPRIM   5
View Object SubType Ids

#define AY_VTFRONT   0
#define AY_VTSIDE   1
#define AY_VTTOP   2
#define AY_VTPERSP   3
#define AY_VTTRIM   4
Shader Types

#define AY_STSURFACE   0
#define AY_STDISPLACEMENT   1
#define AY_STVOLUME   2
#define AY_STLIGHT   3
#define AY_STIMAGER   4
#define AY_STTRANSFORMATION   5
#define AY_STAREALIGHT   6
#define AY_STINTERIOR   7
#define AY_STEXTERIOR   8
#define AY_STATMOSPHERE   9
Shader Argument Types

#define AY_SASCALAR   0
#define AY_SAPOINT   1
#define AY_SANORMAL   2
#define AY_SAVECTOR   3
#define AY_SACOLOR   4
#define AY_SASTRING   5
#define AY_SAMATRIX   6
Light Source Types

#define AY_LITCUSTOM   0
#define AY_LITPOINT   1
#define AY_LITDISTANT   2
#define AY_LITSPOT   3
NURBS Curve Types

#define AY_CTOPEN   0
#define AY_CTCLOSED   1
#define AY_CTPERIODIC   2
Knot Vector Types

#define AY_KTBEZIER   0
#define AY_KTBSPLINE   1
#define AY_KTNURB   2
#define AY_KTCUSTOM   3
#define AY_KTCHORDAL   4
#define AY_KTCENTRI   5
Patch Mesh Types

#define AY_PTBILINEAR   0
#define AY_PTBICUBIC   1
Basis Matrix Types

#define AY_BTBEZIER   0
#define AY_BTBSPLINE   1
#define AY_BTCATMULLROM   2
#define AY_BTHERMITE   3
#define AY_BTCUSTOM   4
Subdivision Schemes

#define AY_SDSCATMULL   0
#define AY_SDSLOOP   1
Subdivision Tag Types

#define AY_SDTHOLE   0
#define AY_SDTCORNER   1
#define AY_SDTCREASE   2
#define AY_SDTIB   3
Procedural Object Types

#define AY_PRTDREADA   0
 Delayed Read Archive.
#define AY_PRTRUNPROG   1
 Run Program.
#define AY_PRTDYNLOAD   2
 Dynamic Load.
Directions

#define AY_NORTH   0
#define AY_EAST   1
#define AY_SOUTH   2
#define AY_WEST   3
Transcendent Tools

#define AY_PI   3.1415926535897932384626433
#define AY_HALFPI   (3.1415926535897932384626433/2.0)
#define AY_D2R(x)   ((x)*AY_PI/180.0)
#define AY_R2D(x)   ((x)*180.0/AY_PI)
#define AY_COT(x)   (cos(x)/sin(x))
Basic Vector Arithmetic

#define AY_VLEN(x, y, z)   sqrt((x*x)+(y*y)+(z*z))
#define AY_V3LEN(v)   sqrt((v[0]*v[0])+(v[1]*v[1])+(v[2]*v[2]))
#define AY_V2LEN(v)   sqrt((v[0]*v[0])+(v[1]*v[1]))
#define AY_V3ZERO(v)   {v[0]=0.0; v[1]=0.0; v[2]=0.0;}
#define AY_V3SUB(r, v1, v2)   {r[0]=v1[0]-v2[0];r[1]=v1[1]-v2[1];r[2]=v1[2]-v2[2];}
#define AY_V3ADD(r, v1, v2)   {r[0]=v1[0]+v2[0];r[1]=v1[1]+v2[1];r[2]=v1[2]+v2[2];}
#define AY_V3MUL(r, v1, v2)   {r[0]=v1[0]*v2[0];r[1]=v1[1]*v2[1];r[2]=v1[2]*v2[2];}
#define AY_V3CROSS(r, v1, v2)   {r[0]=(v1[1] * v2[2]) - (v1[2] * v2[1]);r[1]=(v1[2] * v2[0]) - (v1[0] * v2[2]);r[2]=(v1[0] * v2[1]) - (v1[1] * v2[0]);}
#define AY_V3SCAL(v, f)   {(v[0])*=(f);(v[1])*=(f);(v[2])*=(f);}
#define AY_V2SCAL(v, f)   {(v[0])*=(f);(v[1])*=(f);}
#define AY_V3NORM(v)   {AY_V3SCAL((v),(1.0/(AY_V3LEN(v))));}
#define AY_V2NORM(v)   {AY_V2SCAL((v),(1.0/(AY_V2LEN(v))));}
#define AY_V3DOT(v1, v2)   (v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2])
#define AY_V2DOT(v1, v2)   (v1[0]*v2[0] + v1[1]*v2[1])
#define AY_V4COMP(v1, v2)
#define AY_V3COMP(v1, v2)
#define AY_V2COMP(v1, v2)
Version Strings and Numbers

#define AY_VERSIONSTR   "1.18"
#define AY_VERSIONSTRMI   "0"
#define AY_VERSIONMA   1
#define AY_VERSION   18
#define AY_VERSIONMI   0

Typedefs

typedef int( ay_sevalcb )(Tcl_Interp *interp, char *script, int compile, Tcl_Obj **cscript)
 Script evaluation callback.
typedef void(* ay_voidfp )(void)
 to avoid the use of "void *" to store function pointers
typedef int( ay_createcb )(int argc, char *argv[], ay_object *o)
 Create callback, think constructor.
typedef int( ay_deletecb )(void *c)
 Delete callback, think destructor.
typedef int( ay_copycb )(void *src, void **dst)
 Copy callback, think copy constructor.
typedef int( ay_drawcb )(struct Togl *togl, ay_object *o)
 Draw callback.
typedef int( ay_propcb )(Tcl_Interp *interp, int argc, char *argv[], ay_object *o)
 Get/Set properties callback.
typedef int( ay_getpntcb )(int mode, ay_object *o, double *p, ay_pointedit *pe)
 Select editable points callback.
typedef int( ay_wribcb )(char *file, ay_object *o)
 RIB export callback.
typedef int( ay_readcb )(FILE *fileptr, ay_object *o)
 Read (from Ayam scene file) callback.
typedef int( ay_writecb )(FILE *fileptr, ay_object *o)
 Write (to Ayam scene file) callback.
typedef int( ay_notifycb )(ay_object *o)
 Notification (update after changes to children) callback.
typedef int( ay_treedropcb )(ay_object *o)
 Tree drop (update after Drag and Drop operation in TreeView) callback.
typedef int( ay_comparecb )(ay_object *o1, ay_object *o2)
 Compare callback.
typedef int( ay_convertcb )(ay_object *o, int in_place)
 Convert callback.
typedef int( ay_providecb )(ay_object *o, unsigned int type, ay_object **result)
 Provide callback.
typedef int( ay_bbccb )(ay_object *o, double *bbox, int *flags)
 Calculate bounding box callback.

Variables

Tcl_Interp * ay_interp
 Main Ayam Tcl interpreter.
Tcl_Interp * ay_safeinterp
 Safe Tcl interpreter (e.g. for Script object scripts).
ay_preferences ay_prefs
 user preferences
ay_objectay_root
 pointer to the root object
ay_objectay_endlevel
 pointer to the terminating end level object
ay_object ** ay_next
 pointer to pointer (pointer to some objects ->next or ->down slot) where the next object will be linked to
ay_view_objectay_currentview
 current view
ay_list_objectay_selection
 current object selection
ay_list_objectay_currentlevel
 current level
ay_objectay_clipboard
 object clipboard
GLUquadric * ay_gluquadobj
 global GLU quadric object (for drawing quadrics with GLU)
Tcl_HashTable ay_otypesht
 table of registered object types
Tcl_HashTable ay_typenamesht
 table of registered object type names
Tcl_HashTable ay_tagtypesht
 table of registered tag types
Tcl_HashTable ay_languagesht
 table of registered script languages
ay_ftable ay_sevalcbt
 all registered script evaluation callbacks
int ay_errno
 global error number
int ay_read_version
 currently read scene file version (!= Ayam version!)
int ay_read_viewnum
 currently read view number (internal views get different treatment)
unsigned int ay_current_glname
 current gl name (for object picking)
int ay_wrib_framenum
 current frame number in RIB export
unsigned int ay_current_primlevel
 current primitive level in RIB export (to avoid nested RiSolid()s)
char ay_version_ma []
 major Ayam version number
char ay_version_mi []
 minor Ayam version number

ay_ftable ay_createcbt
 all registered create callbacks
ay_ftable ay_deletecbt
 all registered delete callbacks
ay_ftable ay_copycbt
 all registered copy callbacks
ay_ftable ay_drawcbt
 all registered draw callbacks
ay_ftable ay_drawhcbt
 all registered draw handles callbacks
ay_ftable ay_shadecbt
 all registered shade callbacks
ay_ftable ay_getpropcbt
 all registered get properties callbacks
ay_ftable ay_setpropcbt
 all registered set properties callbacks
ay_ftable ay_getpntcbt
 all registered get points callbacks
ay_ftable ay_wribcbt
 all registered RIB export callbacks
ay_ftable ay_readcbt
 all registered read callbacks
ay_ftable ay_writecbt
 all registered write callbacks
ay_ftable ay_notifycbt
 all registered notify callbacks
ay_ftable ay_bbccbt
 all registered bounding box calculation callbacks
ay_ftable ay_treedropcbt
 all registered tree drop callbacks
ay_ftable ay_convertcbt
 all registered conversion callbacks
ay_ftable ay_providecbt
 all registered provide callbacks
Tag names and types

char * ay_oi_tagtype
char * ay_oi_tagname
char * ay_riattr_tagtype
char * ay_riattr_tagname
char * ay_riopt_tagtype
char * ay_riopt_tagname
char * ay_tc_tagtype
char * ay_tc_tagname
char * ay_pv_tagtype
char * ay_pv_tagname
char * ay_ridisp_tagtype
char * ay_ridisp_tagname
char * ay_rihider_tagtype
char * ay_rihider_tagname
char * ay_noexport_tagtype
char * ay_noexport_tagname
char * ay_tp_tagtype
char * ay_tp_tagname
char * ay_bns_tagtype
char * ay_bns_tagname
char * ay_ans_tagtype
char * ay_ans_tagname
char * ay_dbns_tagtype
char * ay_dbns_tagname
char * ay_dans_tagtype
char * ay_dans_tagname
char * ay_umm_tagtype
char * ay_umm_tagname
char * ay_vmm_tagtype
char * ay_vmm_tagname
char * ay_bp_tagtype
char * ay_bp_tagname
char * ay_np_tagtype
char * ay_np_tagname
char * ay_rp_tagtype
char * ay_rp_tagname
char * ay_hc_tagtype
char * ay_hc_tagname
char * ay_no_tagtype
char * ay_no_tagname
char * ay_nm_tagtype
char * ay_nm_tagname

Detailed Description

Main Ayam Header.


Define Documentation

#define AY_CHTCLERRGOT ( stat,
name,
interp   ) 
Value:
if(stat){\
          ay_error(AY_ERROR, name, Tcl_GetStringResult(interp));\
          Tcl_ResetResult(interp);\
          goto cleanup;}

check and report tcl error status, then jump to cleanup label

#define AY_CHTCLERRRET ( stat,
name,
interp   ) 
Value:
if(stat){\
          ay_error(AY_ERROR, name, Tcl_GetStringResult(interp));\
          Tcl_ResetResult(interp);\
          return TCL_OK;}

check and report tcl error status, then return

#define AY_ISTRAFO (  ) 
Value:
((fabs(o->movx) > AY_EPSILON) ||\
                       (fabs(o->movy) > AY_EPSILON) ||\
                       (fabs(o->movz) > AY_EPSILON) ||\
                       (fabs(o->quat[0]) > AY_EPSILON) ||\
                       (fabs(o->quat[1]) > AY_EPSILON) ||\
                       (fabs(o->quat[2]) > AY_EPSILON) ||\
                       (fabs(1.0 - o->quat[3]) > AY_EPSILON) ||\
                       (fabs(1.0 - o->scalx) > AY_EPSILON) ||\
                       (fabs(1.0 - o->scaly) > AY_EPSILON) ||\
                       (fabs(1.0 - o->scalz) > AY_EPSILON))

is ay_object o transformed?

#define AY_V2COMP ( v1,
v2   ) 
Value:
((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
                           (fabs(v1[1]-v2[1]) < AY_EPSILON))
#define AY_V3COMP ( v1,
v2   ) 
Value:
((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
                           (fabs(v1[1]-v2[1]) < AY_EPSILON) &&\
                           (fabs(v1[2]-v2[2]) < AY_EPSILON))
#define AY_V4COMP ( v1,
v2   ) 
Value:
((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
                           (fabs(v1[1]-v2[1]) < AY_EPSILON) &&\
                           (fabs(v1[2]-v2[2]) < AY_EPSILON) &&\
                           (fabs(v1[3]-v2[3]) < AY_EPSILON))
Generated on Thu Oct 28 19:51:37 2010 for Ayam by  doxygen 1.6.3