• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

ayam.h

Go to the documentation of this file.
00001 #ifndef __ayam_h__
00002 #define __ayam_h__
00003 /*
00004  * Ayam, a free 3D modeler for the RenderMan interface.
00005  *
00006  * Ayam is copyrighted 1998-2002 by Randolf Schultz
00007  * (randolf.schultz@gmail.com) and others.
00008  *
00009  * All rights reserved.
00010  *
00011  * See the file License for details.
00012  *
00013  */
00014 
00015 /* ayam.h - the main Ayam header */
00016 
00017 
00018 /* Includes */
00019 #include <limits.h>
00020 #include <float.h>
00021 #include <math.h>
00022 #include <stdlib.h>
00023 #include <stdio.h>
00024 #include <string.h>
00025 #include <errno.h>
00026 
00027 #ifdef WIN32
00028 #define WIN32_LEAN_AND_MEAN
00029 #include <windows.h>
00030 #undef WIN32_LEAN_AND_MEAN
00031 #endif /* WIN32 */
00032 
00033 #ifdef __cplusplus
00034  extern "C" {
00035 #endif /* __cplusplus */
00036 
00037 #ifdef AYWITHAQUA
00038   #include <OpenGL/glu.h>
00039 #else
00040   #include <GL/glu.h>
00041 #endif /* AYWITHAQUA */
00042 
00043 /*
00044 #ifdef AYUSEORIGTOGL
00045 */
00046 #include <togl.h>
00047 /*
00048 #else
00049 #include <aytogl.h>
00050 #endif*/
00051 /* AYUSEORIGTOGL */
00052 
00053 #ifdef AYUSEAFFINE
00054 #include <ributil.h>
00055 #endif /* AYUSEAFFINE */
00056 
00057 #ifdef AYUSEBMRTRIBOUT
00058 #include <ri.h>
00059 #endif
00060 
00061 #ifdef AYUSEAQSISRIB
00062 #include <ri.h>
00063 #endif
00064 
00065 #ifdef AYUSESLARGS
00066 #include <sl.h>
00067 #endif /* AYUSESLARGS */
00068 
00069 #ifdef AYUSESLCARGS
00070 #include <slc.h>
00071 #endif /* AYUSESLCARGS */
00072 
00073 #ifdef AYUSESLOARGS
00074 #include <slo.h>
00075 #endif /* AYUSESLOARGS */
00076 
00077 #ifdef AYUSESOARGS
00078 #include <so.h>
00079 #endif /* AYUSESOARGS */
00080 
00081 #ifdef AYUSESLXARGS
00082 #include <slx.h>
00083 #endif /* AYUSESLXARGS */
00084 
00085 #define AYGLUCBTYPE
00086 
00087 #ifdef WIN32
00088  #undef AYGLUCBTYPE
00089  #define AYGLUCBTYPE (GLUnurbsErrorProc)
00090  #ifdef AYMESASGIGLU
00091   #undef AYGLUCBTYPE
00092   #define AYGLUCBTYPE (_GLUfuncptr)
00093  #endif
00094 #endif
00095 
00096 
00097 /* Ayam Object Structure */
00098 
00100 typedef struct ay_point_s
00101 {
00102   struct ay_point_s *next; 
00103   char rational; 
00104   char readonly;  
00105   double *point; 
00106   unsigned int index; 
00107 } ay_point;
00108 
00109 
00111 typedef struct ay_mpoint_s
00112 {
00113   struct ay_mpoint_s *next; 
00114   int multiplicity; 
00115   double **points; 
00116   unsigned int *indices; 
00117 } ay_mpoint;
00118 
00119 
00121 typedef struct ay_pointedit_s
00122 {
00123   unsigned int num; 
00124   double **coords; 
00125   unsigned int *indices; 
00126   char rational; 
00127   char readonly; 
00128 } ay_pointedit;
00129 
00130 
00132 typedef struct ay_tag_s
00133 {
00134   struct ay_tag_s *next; 
00135   char is_intern; 
00136   char is_binary; 
00137   char *name; 
00138   char *type; 
00139   void *val; 
00140 } ay_tag;
00141 
00142 
00144 typedef struct ay_btval_s
00145 {
00146   size_t size; 
00147   void *payload; 
00148 } ay_btval;
00149 
00151 typedef struct ay_trafo_s
00152 {
00154 
00155   double movx, movy, movz;
00158 
00159   double rotx, roty, rotz;
00162 
00163   double scalx, scaly, scalz;
00165   double quat[4]; 
00166 } ay_trafo;
00167 
00168 
00170 typedef struct ay_object_s {
00171   struct ay_object_s *next;  
00172   struct ay_object_s *down;  
00175   unsigned int type;
00176 
00178   char *name;
00179 
00181   unsigned int glname;
00182 
00184   unsigned int refcount;
00185 
00187   int selected;
00188 
00190   int modified;
00191 
00193   int parent;
00194 
00196   int inherit_trafos;
00197 
00198   /* Visibility */
00200   int hide;
00202   int hide_children;
00203 
00206   double movx, movy, movz;
00211   double rotx, roty, rotz;
00216   double scalx, scaly, scalz;
00219   double quat[4]; 
00221 #if 0
00222   ay_trafo *trafo; 
00223 #endif
00224   ay_point *selp; 
00226   ay_tag *tags; 
00228   struct ay_mat_object_s *mat; 
00230   void *refine; 
00231 } ay_object;
00232 
00233 
00235 typedef struct ay_list_object_s
00236 {
00237   struct ay_list_object_s *next; 
00238   ay_object *object; 
00239 } ay_list_object;
00240 
00241 
00242 /* Shaders */
00243 
00245 typedef struct ay_shader_arg_s
00246 {
00247   struct ay_shader_arg_s *next; 
00248   char *name; 
00249   int type; 
00251   union {
00252     float color[3];
00253     float point[4];
00254     float matrix[16];
00255     float scalar;
00256     char *string;
00257   } val; 
00258 } ay_shader_arg;
00259 
00260 
00262 typedef struct ay_shader_s
00263 {
00264   struct ay_shader_s *next; 
00265   int type; 
00267   char *name; 
00268   ay_shader_arg *arg; 
00269 } ay_shader;
00270 
00271 
00273 typedef struct ay_mat_object_s {
00274 
00275   int registered; 
00277   char **nameptr; 
00278   unsigned int *refcountptr; 
00279   ay_object *objptr; 
00281   /* RiStandard (3.1) Attributes */
00282 
00285   int colr, colg, colb;
00290   int opr, opg, opb;
00293   /* Matte */
00294   int matte; 
00296   /* Shading */
00297   double shading_rate; 
00298   int shading_interpolation; 
00300   /* Displacement */
00301   double dbound_val; 
00302   int dbound; 
00304   /* Sidedness */
00305   int sides; 
00307   /* Shaders */
00309   ay_shader *sshader;
00311   ay_shader *dshader;
00313   ay_shader *ishader;
00315   ay_shader *eshader;
00316 
00317   /* BMRT Specific Attributes */
00318    /* Radiosity */
00321     int avr, avg, avb, ava;
00325     int emr, emg, emb, ema;
00329     int spr, spg, spb, spa;
00331     /* Meshing */
00332     double patch_size; 
00333     double elem_size; 
00334     double min_size; 
00335     /* Calculation */
00336     int zonal; 
00338     /* Caustics */
00339     int has_caustics; 
00341    /* Shadows */
00342    int cast_shadows; 
00344    /* Displacements */
00345    int true_displacement; 
00347    /* Visibility */
00348    int camera; 
00349    int reflection; 
00350    int shadow; 
00352 } ay_mat_object;
00353 
00355 typedef struct ay_riopt_s
00356 {
00357   double Variance; 
00358   double Samples_X; 
00359   double Samples_Y; 
00360   char FilterFunc; 
00361   double FilterWidth; 
00362   double FilterHeight; 
00363   double ExpGain; 
00364   double ExpGamma; 
00365   double RGBA_ONE; 
00366   double RGBA_MIN; 
00367   double RGBA_MAX; 
00368   double RGBA_Dither; 
00370   int MinSamples; 
00371   int MaxSamples; 
00372   int MaxRayLevel; 
00373   double ShadowBias; 
00374   char PRManSpec; 
00375   int RadSteps; 
00376   int PatchSamples; 
00378   char *textures; 
00379   char *shaders; 
00380   char *archives; 
00381   char *procedurals; 
00383   int texturemem; 
00384   int geommem; 
00386   int width; 
00387   int height; 
00389   int use_std_display; 
00390 } ay_riopt;
00391 
00392 
00394 typedef struct ay_root_object_s
00395 {
00396   ay_riopt  *riopt; 
00397   ay_shader *imager; 
00398   ay_shader *atmosphere; 
00399 } ay_root_object;
00400 
00401 
00403 typedef struct ay_nurbcurve_object_s
00404 {
00405   int type; 
00406   int length; 
00407   int order; 
00408   int knot_type; 
00409   int is_rat; 
00410   double *controlv; 
00411   double *knotv; 
00413   double glu_sampling_tolerance; 
00414   int display_mode; 
00416   GLUnurbsObj *no; 
00418   /* stess */
00419   int tesslen; 
00420   double *tessv; 
00421   int tessqf; 
00423   /* multiple points */
00424   int createmp; 
00425   ay_mpoint *mpoints; 
00426 } ay_nurbcurve_object;
00427 
00428 
00430 typedef struct ay_stess_uvp_s {
00431   struct ay_stess_uvp_s *next; 
00432   int type; 
00433   int dir; 
00434 
00435   double u, v;
00437   double C[6]; 
00438 } ay_stess_uvp;
00439 
00440 
00442 typedef struct ay_stess_s {
00443   /* untrimmed patch */
00444   int tessw; 
00445   int tessh; 
00446   double *tessv; 
00448   /* trimmed patch */
00449   int upslen; 
00450   int vpslen; 
00451   ay_stess_uvp **ups; 
00452   ay_stess_uvp **vps; 
00454   int ft_cw; 
00455   int tcslen; 
00456   double **tcs; 
00457   int *tcslens; 
00458   int *tcsdirs; 
00460   double ud; 
00461   double vd; 
00462 } ay_stess;
00463 
00464 
00466 typedef struct ay_nurbpatch_object_s
00467 {
00468   int width; 
00469   int height; 
00470   int uorder; 
00471   int vorder; 
00472   int uknot_type; 
00473   int vknot_type; 
00475   int utype; 
00476   int vtype; 
00478   int is_rat; 
00480   double *controlv; 
00481   double *uknotv; 
00482   double *vknotv; 
00483   /*double *texv;*/ /* unused */
00484 
00485   GLUnurbsObj *no; 
00487   double glu_sampling_tolerance; 
00488   int display_mode; 
00490   /* stess */
00491   int tessqf; 
00492   ay_stess *stess; 
00494   /* multiple points */
00495   int createmp; 
00496   ay_mpoint *mpoints; 
00497 } ay_nurbpatch_object;
00498 
00499 
00501 typedef struct ay_ipatch_object_s {
00502   int width; 
00503   int height; 
00504   int close_u; 
00505   int close_v; 
00506   int order_u; 
00507   int order_v; 
00508   int ktype_u; 
00509   int ktype_v; 
00511   double *controlv; 
00513   double sdlen_u; 
00514   double edlen_u; 
00516   double sdlen_v; 
00517   double edlen_v; 
00519   int derivs_u; 
00520   double *sderiv_u; 
00521   double *ederiv_u; 
00523   int derivs_v; 
00524   double *sderiv_v; 
00525   double *ederiv_v; 
00528   ay_object *npatch;
00529 
00530   double glu_sampling_tolerance; 
00531   int display_mode; 
00532 } ay_ipatch_object;
00533 
00534 
00536 typedef struct ay_pamesh_object_s {
00537   int width; 
00538   int height; 
00539   int close_u; 
00540   int close_v; 
00541   double *controlv; 
00543   int type; 
00544   int btype_u; 
00545   int btype_v; 
00546   int ustep; 
00547   double *ubasis; 
00548   int vstep; 
00549   double *vbasis; 
00552   ay_object *npatch;
00553 
00554   double glu_sampling_tolerance; 
00555   int display_mode; 
00556 } ay_pamesh_object;
00557 
00558 
00560 typedef struct ay_pomesh_object_s {
00561   int type; 
00563   unsigned int npolys; 
00564   unsigned int *nloops; 
00565   unsigned int *nverts; 
00566   unsigned int *verts; 
00568   unsigned int ncontrols; 
00569   int has_normals; 
00570   double *controlv; 
00571 } ay_pomesh_object;
00572 
00573 
00575 typedef struct ay_sdmesh_object_s {
00576   int scheme; 
00578   unsigned int nfaces; 
00579   unsigned int *nverts; 
00580   unsigned int *verts; 
00581   unsigned int ntags; 
00582   int *tags; 
00583   unsigned int *nargs; 
00584   int *intargs; 
00585   double *floatargs; 
00587   unsigned int ncontrols; 
00588   double *controlv; 
00590   unsigned int level;  
00591   char drawsub;  
00594   ay_object *pomesh;
00595 } ay_sdmesh_object;
00596 
00597 
00599 typedef struct ay_gordon_object_s {
00600   int wcc; 
00601   int uorder; 
00602   int vorder; 
00605   ay_object *caps_and_bevels;
00606 
00608   ay_object *npatch;
00609 
00610   double glu_sampling_tolerance; 
00611   int display_mode; 
00612 } ay_gordon_object;
00613 
00614 
00616 typedef struct ay_text_object_s
00617 {
00618   char *fontname; 
00619   Tcl_UniChar *unistring; 
00620   double height; 
00621   int revert; 
00622   int has_upper_cap; 
00623   int has_lower_cap; 
00626   ay_object *npatch;
00627 
00628   double *pnts; 
00629   unsigned int pntslen; 
00631   double glu_sampling_tolerance; 
00632   int display_mode; 
00633 } ay_text_object;
00634 
00635 
00637 typedef struct ay_light_object_s
00638 {
00639   int type; 
00640   int on; 
00641   int local; 
00642   RtLightHandle light_handle; 
00643   int shadows; 
00644   int samples; 
00645 
00646   int colr, colg, colb;
00648   double intensity; 
00649   double cone_angle; 
00650   double cone_delta_angle; 
00651   double beam_distribution; 
00652   int use_sm; 
00653   int sm_resolution; 
00654   ay_shader *lshader; 
00655   double tfrom[3]; 
00656   double tto[3]; 
00657 } ay_light_object;
00658 
00659 
00661 typedef struct ay_level_object_s
00662 {
00663   int type; 
00664 } ay_level_object;
00665 
00666 
00668 typedef struct ay_box_object_s
00669 {
00670   double width; 
00671   double length; 
00672   double height; 
00673   double *pnts; 
00674 } ay_box_object;
00675 
00676 
00678 typedef struct ay_bpatch_object_s
00679 {
00680   double p1[3]; 
00681   double p2[3]; 
00682   double p3[3]; 
00683   double p4[3]; 
00684 } ay_bpatch_object;
00685 
00686 
00688 typedef struct ay_sphere_object_s
00689 {
00690   char closed; 
00691   char is_simple; 
00692   double radius; 
00693   double zmin; 
00694   double zmax; 
00695   double thetamax; 
00696   double *pnts; 
00697 } ay_sphere_object;
00698 
00699 
00701 typedef struct ay_cone_object_s
00702 {
00703   char closed; 
00704   char is_simple; 
00705   double radius; 
00706   double height; 
00707   double thetamax; 
00708   double *pnts; 
00709 } ay_cone_object;
00710 
00711 
00713 typedef struct ay_disk_object_s
00714 {
00715   char is_simple; 
00716   double radius; 
00717   double height; 
00718   double thetamax; 
00719   double *pnts; 
00720 } ay_disk_object;
00721 
00722 
00724 typedef struct ay_cylinder_object_s
00725 {
00726   char closed; 
00727   char is_simple; 
00728   double radius; 
00729   double zmin; 
00730   double zmax; 
00731   double thetamax; 
00732   double *pnts; 
00733 } ay_cylinder_object;
00734 
00735 
00737 typedef struct ay_hyperboloid_s
00738 {
00739   char closed; 
00740   double p1[3]; 
00741   double p2[3]; 
00742   double thetamax; 
00743   double *pnts; 
00744 } ay_hyperboloid_object;
00745 
00746 
00748 typedef struct ay_paraboloid_object_s
00749 {
00750   char closed; 
00751   double rmax; 
00752   double zmin; 
00753   double zmax; 
00754   double thetamax; 
00755   double *pnts; 
00756 } ay_paraboloid_object;
00757 
00758 
00760 typedef struct ay_torus_object_s
00761 {
00762   char closed; 
00763   double majorrad; 
00764   double minorrad; 
00765   double phimin; 
00766   double phimax; 
00767   double thetamax; 
00768   double *pnts; 
00769 } ay_torus_object;
00770 
00771 
00773 typedef struct ay_icurve_object_s
00774 {
00775   int type; 
00776   int length; 
00777   int order; 
00779   int param_type;  
00780   double sdlen; 
00781   double edlen; 
00783   double *controlv; 
00785   int derivs; 
00786   double sderiv[3]; 
00787   double ederiv[3]; 
00790   ay_object *ncurve;
00791 
00792   double glu_sampling_tolerance; 
00793   int display_mode; 
00794 } ay_icurve_object;
00795 
00796 
00798 typedef struct ay_acurve_object_s
00799 {
00800   int length; 
00801   int alength; 
00802   int closed; 
00803   int symmetric; 
00804   int order; 
00806   double *controlv; 
00809   ay_object *ncurve;
00810 
00811   double glu_sampling_tolerance; 
00812   int display_mode; 
00813 } ay_acurve_object;
00814 
00815 
00817 typedef struct ay_concatnc_object_s
00818 {
00819   int closed; 
00820   int fillgaps; 
00821   int revert; 
00822   int knot_type; 
00823   double ftlength; 
00826   ay_object *ncurve;
00827 
00828   double glu_sampling_tolerance; 
00829   int display_mode; 
00830 } ay_concatnc_object;
00831 
00832 
00834 typedef struct ay_offnc_object_s
00835 {
00836   int mode; 
00837   int revert; 
00838   double offset; 
00841   ay_object *ncurve;
00842 
00843   double glu_sampling_tolerance; 
00844   int display_mode; 
00845 } ay_offnc_object;
00846 
00847 
00849 typedef struct ay_cap_object_s
00850 {
00851   int type; 
00854   ay_object *npatch;
00855 
00856   double glu_sampling_tolerance; 
00857   int display_mode; 
00858 } ay_cap_object;
00859 
00860 
00862 typedef struct ay_bevel_object_s
00863 {
00864   int has_cap; 
00867   ay_object *npatch;
00868 
00869   double glu_sampling_tolerance; 
00870   int display_mode; 
00871 } ay_bevel_object;
00872 
00873 
00875 typedef struct ay_clone_object_s
00876 {
00877   int numclones; 
00878   int rotate; 
00879   int mirror; 
00881   /* transformations */
00883   double movx, movy, movz;
00885 
00886   double rotx, roty, rotz;
00889 
00890   double scalx, scaly, scalz;
00892   double quat[4]; 
00894   double *pnts; 
00895   unsigned int pntslen; 
00898   ay_object *clones;
00899 } ay_clone_object;
00900 
00901 
00903 typedef struct ay_camera_object_s
00904 {
00905   double from[3]; 
00906   double to[3]; 
00907   double up[3]; 
00908   double roll; 
00909   double zoom; 
00910   double nearp; 
00911   double farp; 
00912 } ay_camera_object;
00913 
00914 
00916 typedef struct ay_riinc_object_s
00917 {
00920   double width, length, height;
00922   char *file; 
00923 } ay_riinc_object;
00924 
00925 
00927 typedef struct ay_riproc_object_s
00928 {
00929   int type; 
00932   double minx, miny, minz, maxx, maxy, maxz;
00934   char *file; 
00935   char *data; 
00936 } ay_riproc_object;
00937 
00938 
00940 typedef struct ay_revolve_object_s
00941 {
00942   double thetamax; 
00943   int sections; 
00944   int order; 
00945   int has_upper_cap; 
00946   ay_object *upper_cap; 
00947   int has_lower_cap; 
00948   ay_object *lower_cap; 
00949   int has_start_cap; 
00950   ay_object *start_cap; 
00951   int has_end_cap; 
00952   ay_object *end_cap; 
00955   ay_object *npatch;
00956 
00957   double glu_sampling_tolerance; 
00958   int display_mode; 
00959 } ay_revolve_object;
00960 
00961 
00963 typedef struct ay_extrude_object_s
00964 {
00965   double height; 
00966   int has_upper_cap; 
00967   int has_lower_cap; 
00970   ay_object *caps_and_bevels;
00971 
00973   ay_object *npatch;
00974 
00975   double glu_sampling_tolerance; 
00976   int display_mode; 
00977 } ay_extrude_object;
00978 
00979 
00981 typedef struct ay_sweep_object_s
00982 {
00983   int rotate; 
00984   int interpolate; 
00985   int close; 
00986   int sections; 
00987   int has_start_cap; 
00988   int has_end_cap; 
00991   ay_object *caps_and_bevels;
00992 
00994   ay_object *npatch;
00995 
00996   double glu_sampling_tolerance; 
00997   int display_mode; 
00998 } ay_sweep_object;
00999 
01000 
01002 typedef struct ay_swing_object_s
01003 {
01004   int has_upper_cap; 
01005   ay_object *upper_cap; 
01006   int has_lower_cap; 
01007   ay_object *lower_cap; 
01008   int has_start_cap; 
01009   ay_object *start_cap; 
01010   int has_end_cap; 
01011   ay_object *end_cap; 
01014   ay_object *npatch;
01015 
01016   double glu_sampling_tolerance; 
01017   int display_mode; 
01018 } ay_swing_object;
01019 
01020 
01022 typedef struct ay_birail1_object_s
01023 {
01024   int type; 
01025   int sections; 
01026   int has_start_cap; 
01027   int has_end_cap; 
01030   ay_object *caps_and_bevels;
01031 
01033   ay_object *npatch;
01034 
01035   double glu_sampling_tolerance; 
01036   int display_mode; 
01037 } ay_birail1_object;
01038 
01039 
01041 typedef struct ay_birail2_object_s
01042 {
01043   int close; 
01044   int sections; 
01045   int interpolctrl;  
01046   int has_start_cap; 
01047   int has_end_cap; 
01050   ay_object *caps_and_bevels;
01051 
01053   ay_object *npatch;
01054 
01055   double glu_sampling_tolerance; 
01056   int display_mode; 
01057 } ay_birail2_object;
01058 
01059 
01061 typedef struct ay_skin_object_s
01062 {
01063   int interpolate; 
01064   int uorder; 
01065   int uknot_type; 
01066   double uknotv; 
01067   int has_start_cap; 
01068   int has_end_cap; 
01071   ay_object *caps_and_bevels;
01072 
01074   ay_object *npatch;
01075 
01076   double glu_sampling_tolerance; 
01077   int display_mode; 
01078 } ay_skin_object;
01079 
01080 
01082 typedef struct ay_extrnc_object_s
01083 {
01084   int side; 
01085   int pnum; 
01086   int revert; 
01087   int relative; 
01088   int create_pvn; 
01089   double parameter; 
01092   ay_object *ncurve;
01093 
01094   double glu_sampling_tolerance; 
01095   int display_mode; 
01096 } ay_extrnc_object;
01097 
01098 
01100 typedef struct ay_extrnp_object_s
01101 {
01102   int pnum; 
01103   int relative; 
01106   double umin, umax, vmin, vmax;
01110   ay_object *npatch;
01111 
01112   double glu_sampling_tolerance; 
01113   int display_mode; 
01114 } ay_extrnp_object;
01115 
01116 
01118 typedef struct ay_concatnp_object_s
01119 {
01120   int type; 
01121   int order; 
01122   int revert; 
01123   int knot_type; 
01125   int fillgaps; 
01126   double ftlength; 
01128   char *uv_select; 
01131   ay_object *npatch;
01132 
01133   double glu_sampling_tolerance; 
01134   int display_mode; 
01135 } ay_concatnp_object;
01136 
01137 
01139 typedef struct ay_offnp_object_s
01140 {
01141   int mode; 
01142   double offset; 
01145   ay_object *npatch;
01146 
01147   double glu_sampling_tolerance; 
01148   int display_mode; 
01149 } ay_offnp_object;
01150 
01151 
01153 typedef struct ay_ncircle_object_s
01154 {
01155   double radius; 
01156   double tmin; 
01157   double tmax; 
01160   ay_object *ncurve;
01161 
01162   double glu_sampling_tolerance; 
01163   int display_mode; 
01164 } ay_ncircle_object;
01165 
01166 
01168 typedef int (ay_sevalcb) (Tcl_Interp *interp, char *script, int compile,
01169                           Tcl_Obj **cscript);
01170 
01171 
01173 typedef struct ay_script_object_s
01174 {
01175   char *script; 
01176   int active; 
01177   int type; 
01178   ay_object *cm_objects; 
01180   int modified; 
01181   Tcl_Obj *cscript; 
01183   int paramslen; 
01184   Tcl_Obj **params; 
01186   double *pnts; 
01187   unsigned int pntslen; 
01189   ay_sevalcb *cb; 
01190 } ay_script_object;
01191 
01192 
01194 typedef struct ay_view_object_s
01195 {
01196   struct Togl *togl; 
01197   int type; 
01198   double grid; 
01200   int local; 
01201   int aligned; 
01203   int drawsel; 
01204   int drawlevel; 
01205   int redraw; 
01206   int drawgrid; 
01207   int usegrid; 
01208   int shade; 
01209   int antialiaslines; 
01211   /*#ifdef AY_ENABLEPPREV*/
01212   int ppreview; 
01213   /*#endif*/
01214 
01215   int drawobjectcs; 
01217   /* camera */
01218   double from[3]; 
01219   double to[3]; 
01220   double up[3]; 
01221   double roll; 
01222   double zoom; 
01223   double nearp; 
01224   double farp; 
01228   double rotx, roty, rotz;
01233   double conv_x, conv_y;
01238   double rect_xmin, rect_xmax, rect_ymin, rect_ymax;
01240   int drawrect; 
01244   double markworld[3];
01245   double markx;
01246   double marky;
01248   int drawmark; 
01252   int pos_x, pos_y;
01256   int isicon;
01257 
01259   int drawhandles;
01260 
01262   int dirty;
01263 
01264   /* background image */
01265   char *bgimage; 
01266   int bgimagedirty; 
01267   int drawbgimage; 
01271   int bgwidth, bgheight;
01272   int bguorder, bgvorder;
01273   float *bgknotv, *bgcv;
01278   int id;
01279 
01280   int transform_points; 
01282   int enable_undo; 
01286   Togl_Callback *altdispcb;
01287 } ay_view_object;
01288 
01289 
01291 typedef struct ay_select_object_s
01292 {
01293   char *indices; 
01294   int length; 
01295   int *seli; 
01296 } ay_select_object;
01297 
01298 
01300 typedef struct ay_trim_object_s
01301 {
01302   int patchnum; 
01305   ay_object *npatch;
01306 } ay_trim_object;
01307 
01308 
01310 typedef struct ay_preferences_s
01311 {
01312   int list_types; 
01313   int mark_hidden; 
01314   int single_window; 
01316   /* modelling prefs */
01317   int edit_snaps_to_grid; 
01318   int snap3d; 
01319   int allow_warp;  
01320   double pick_epsilon; 
01321   int lazynotify; 
01322   int completenotify; 
01323   int undo_levels; 
01324   int globalmark; 
01326   /* RIB export prefs */
01327   int resolveinstances; 
01328   int checklights; 
01329   int ristandard; 
01330   int use_sm; 
01331   int defaultmat; 
01332   int writeident; 
01333   int excludehidden; 
01335   /* Mops Import prefs */
01336   int mopsiresetdisplaymode; 
01337   int mopsiresettolerance; 
01339   /* drawing */
01340   double handle_size; 
01344   double bgr, bgg, bgb;
01348   double obr, obg, obb;
01352   double ser, seg, seb;
01356   double grr, grg, grb;
01360   double tpr, tpg, tpb;
01364   double shr, shg, shb;
01368   double lir, lig, lib;
01372   double sxr, sxg, sxb;
01375   int use_materialcolor; 
01377   double linewidth; 
01378   double sellinewidth; 
01380   /* error handling */
01381   char onerror; 
01382   char errorlevel; 
01383   int writelog; 
01384   char *logfile; 
01386   /* state of the RIB exporter */
01387   int wrib_sm; 
01388   int wrib_em; 
01389   int wrib_archives; 
01392   double glu_sampling_tolerance; 
01393   int np_display_mode; 
01394   int nc_display_mode; 
01395   int glu_cache_float; 
01397   int stess_qf; 
01400   int smethod;
01401   double sparamu; 
01402   double sparamv; 
01405   int wutag;
01406 
01407   double polyoffset0; 
01408   double polyoffset1; 
01411   int save_rootviews;
01412 
01414   int pprev_open;
01415   char *pprender; 
01418   int conv_reset_display;
01419 
01420   /* PV tag names */
01421   char *texcoordname; 
01422   char *normalname; 
01423   char *colorname; 
01425 } ay_preferences;
01426 
01427 
01429 typedef void (*ay_voidfp)(void);
01430 
01432 typedef struct ay_ftable_s
01433 {
01434   unsigned int size; 
01435   ay_voidfp *arr; 
01436 } ay_ftable;
01437 
01438 /* Callbacks */
01439 
01441 typedef int (ay_createcb) (int argc, char *argv[], ay_object *o);
01442 
01444 typedef int (ay_deletecb) (void *c);
01445 
01447 typedef int (ay_copycb) (void *src, void **dst);
01448 
01450 typedef int (ay_drawcb) (struct Togl *togl,  ay_object *o);
01451 
01453 typedef int (ay_propcb) (Tcl_Interp *interp, int argc, char *argv[],
01454                          ay_object *o);
01455 
01457 typedef int (ay_getpntcb) (int mode, ay_object *o, double *p,
01458                            ay_pointedit *pe);
01459 
01461 typedef int (ay_wribcb) (char *file, ay_object *o);
01462 
01464 typedef int (ay_readcb) (FILE *fileptr, ay_object *o);
01465 
01467 typedef int (ay_writecb) (FILE *fileptr, ay_object *o);
01468 
01470 typedef int (ay_notifycb) (ay_object *o);
01471 
01473 typedef int (ay_treedropcb) (ay_object *o);
01474 
01476 typedef int (ay_comparecb) (ay_object *o1, ay_object *o2);
01477 
01479 typedef int (ay_convertcb) (ay_object *o, int in_place);
01480 
01482 typedef int (ay_providecb) (ay_object *o, unsigned int type,
01483                             ay_object **result);
01484 
01486 typedef int (ay_bbccb) (ay_object *o, double *bbox, int *flags);
01487 
01488 
01489 /* Globals */
01490 
01492 extern Tcl_Interp *ay_interp;
01493 
01495 extern Tcl_Interp *ay_safeinterp;
01496 
01498 extern ay_preferences ay_prefs;
01499 
01501 extern ay_object *ay_root;
01502 
01504 extern ay_object *ay_endlevel;
01505 
01508 extern ay_object **ay_next;
01509 
01511 extern ay_view_object *ay_currentview;
01512 
01514 extern ay_list_object *ay_selection;
01515 
01517 extern ay_list_object *ay_currentlevel;
01518 
01520 extern ay_object *ay_clipboard;
01521 
01523 extern GLUquadric *ay_gluquadobj;
01524 
01526 extern Tcl_HashTable ay_otypesht;
01527 
01529 extern Tcl_HashTable ay_typenamesht;
01530 
01532 extern Tcl_HashTable ay_tagtypesht;
01533 
01535 extern Tcl_HashTable ay_languagesht;
01536 
01537 /* \name function pointer tables (object callbacks) */
01540 extern ay_ftable ay_createcbt;
01542 extern ay_ftable ay_deletecbt;
01544 extern ay_ftable ay_copycbt;
01546 extern ay_ftable ay_drawcbt;
01548 extern ay_ftable ay_drawhcbt;
01550 extern ay_ftable ay_shadecbt;
01552 extern ay_ftable ay_getpropcbt;
01554 extern ay_ftable ay_setpropcbt;
01556 extern ay_ftable ay_getpntcbt;
01558 extern ay_ftable ay_wribcbt;
01560 extern ay_ftable ay_readcbt;
01562 extern ay_ftable ay_writecbt;
01564 extern ay_ftable ay_notifycbt;
01566 extern ay_ftable ay_bbccbt;
01568 extern ay_ftable ay_treedropcbt;
01570 extern ay_ftable ay_convertcbt;
01572 extern ay_ftable ay_providecbt;
01576 extern ay_ftable ay_sevalcbt;
01577 
01579 extern int ay_errno;
01580 
01582 extern int ay_read_version;
01583 
01585 extern int ay_read_viewnum;
01586 
01588 extern unsigned int ay_current_glname;
01589 
01591 extern int ay_wrib_framenum;
01592 
01594 extern unsigned int ay_current_primlevel;
01595 
01597 extern char ay_version_ma[];
01599 extern char ay_version_mi[];
01600 
01603 extern char *ay_oi_tagtype;
01604 extern char *ay_oi_tagname;
01605 extern char *ay_riattr_tagtype;
01606 extern char *ay_riattr_tagname;
01607 extern char *ay_riopt_tagtype;
01608 extern char *ay_riopt_tagname;
01609 extern char *ay_tc_tagtype;
01610 extern char *ay_tc_tagname;
01611 extern char *ay_pv_tagtype;
01612 extern char *ay_pv_tagname;
01613 extern char *ay_ridisp_tagtype;
01614 extern char *ay_ridisp_tagname;
01615 extern char *ay_rihider_tagtype;
01616 extern char *ay_rihider_tagname;
01617 extern char *ay_noexport_tagtype;
01618 extern char *ay_noexport_tagname;
01619 extern char *ay_tp_tagtype;
01620 extern char *ay_tp_tagname;
01621 extern char *ay_bns_tagtype;
01622 extern char *ay_bns_tagname;
01623 extern char *ay_ans_tagtype;
01624 extern char *ay_ans_tagname;
01625 extern char *ay_dbns_tagtype;
01626 extern char *ay_dbns_tagname;
01627 extern char *ay_dans_tagtype;
01628 extern char *ay_dans_tagname;
01629 extern char *ay_umm_tagtype;
01630 extern char *ay_umm_tagname;
01631 extern char *ay_vmm_tagtype;
01632 extern char *ay_vmm_tagname;
01633 extern char *ay_bp_tagtype;
01634 extern char *ay_bp_tagname;
01635 extern char *ay_np_tagtype;
01636 extern char *ay_np_tagname;
01637 extern char *ay_rp_tagtype;
01638 extern char *ay_rp_tagname;
01639 extern char *ay_hc_tagtype;
01640 extern char *ay_hc_tagname;
01641 extern char *ay_no_tagtype;
01642 extern char *ay_no_tagname;
01643 extern char *ay_nm_tagtype;
01644 extern char *ay_nm_tagname;
01649 extern char *ay_error_igntype;
01652 /* Definitions */
01653 
01656 #define AY_TRUE      1
01657 #define AY_FALSE     0
01658 
01662 #define AY_OK          0 /* everything all right */
01663 #define AY_EWARN       1 /* warning */
01664 #define AY_ERROR       2 /* unspecified error */
01665 #define AY_EFLUSH      3 /* flush error messages */
01666 #define AY_EOUTPUT     4 /* used for unspecific output */
01667 #define AY_EOMEM       5 /* out of memory */
01668 #define AY_EOPENFILE  10 /* error opening file */
01669 #define AY_ECLOSEFILE 11 /* error closing file */
01670 #define AY_EFORMAT    12 /* wrong file format  */
01671 #define AY_EUEOF      13 /* unexpected EOF read */
01672 #define AY_EEOF       14 /* EOF read */
01673 #define AY_EDONOTLINK 15 /* do not link read object */
01674 #define AY_ERANGE     16 /* argument out of range */
01675 #define AY_ENOSEL     20 /* nothing selected */
01676 #define AY_EARGS      21 /* missing or wrong args */
01677 #define AY_EOPT       22 /* missing or malformed option value */
01678 #define AY_EUOPT      23 /* unknown option */
01679 #define AY_EWTYPE     24 /* object is of wrong type */
01680 #define AY_ETYPE      30 /* type already exists */
01681 #define AY_ENTYPE     31 /* type does not exist */
01682 #define AY_EREF       40 /* reference counter not zero */
01683 #define AY_ENULL      50 /* illegal zero pointer encountered */
01684 
01688 #define AY_IDROOT           0
01689 #define AY_IDNPATCH         1
01690 #define AY_IDNCURVE         2
01691 #define AY_IDLEVEL          3
01692 #define AY_IDLIGHT          4
01693 #define AY_IDBOX            5
01694 #define AY_IDBPATCH         6
01695 #define AY_IDVIEW           7
01696 #define AY_IDCAMERA         8
01697 #define AY_IDINSTANCE       9
01698 #define AY_IDSPHERE        10
01699 #define AY_IDDISK          11
01700 #define AY_IDCONE          12
01701 #define AY_IDCYLINDER      13
01702 #define AY_IDPARABOLOID    14
01703 #define AY_IDHYPERBOLOID   15
01704 #define AY_IDTORUS         16
01705 #define AY_IDRIINC         17
01706 #define AY_IDMATERIAL      18
01707 #define AY_IDICURVE        19
01708 #define AY_IDREVOLVE       20
01709 #define AY_IDEXTRUDE       21
01710 #define AY_IDSWEEP         22
01711 #define AY_IDSKIN          23
01712 #define AY_IDCAP           24
01713 #define AY_IDPAMESH        25
01714 #define AY_IDPOMESH        26
01715 #define AY_IDCONCATNC      27
01716 #define AY_IDCLONE         28
01717 #define AY_IDSDMESH        29
01718 #define AY_IDGORDON        30
01719 #define AY_IDTEXT          31
01720 #define AY_IDBIRAIL1       32
01721 #define AY_IDBIRAIL2       33
01722 #define AY_IDEXTRNC        34
01723 #define AY_IDSCRIPT        35
01724 #define AY_IDRIPROC        36
01725 #define AY_IDBEVEL         37
01726 #define AY_IDNCIRCLE       38
01727 #define AY_IDSWING         39
01728 #define AY_IDSELECT        40
01729 #define AY_IDEXTRNP        41
01730 #define AY_IDOFFNC         42
01731 #define AY_IDACURVE        43
01732 #define AY_IDTRIM          44
01733 #define AY_IDCONCATNP      45
01734 #define AY_IDOFFNP         46
01735 #define AY_IDIPATCH        47
01736 #define AY_IDMIRROR        48
01737 
01738 #define AY_IDLAST          50
01739 
01743 #define AY_LTEND    0
01744 #define AY_LTLEVEL  1
01745 #define AY_LTUNION  2
01746 #define AY_LTDIFF   3
01747 #define AY_LTINT    4
01748 #define AY_LTPRIM   5
01749 
01753 #define AY_VTFRONT  0
01754 #define AY_VTSIDE   1
01755 #define AY_VTTOP    2
01756 #define AY_VTPERSP  3
01757 #define AY_VTTRIM   4
01758 
01762 #define AY_STSURFACE        0
01763 #define AY_STDISPLACEMENT   1
01764 #define AY_STVOLUME         2
01765 #define AY_STLIGHT          3
01766 #define AY_STIMAGER         4
01767 #define AY_STTRANSFORMATION 5
01768 
01769 #define AY_STAREALIGHT      6
01770 #define AY_STINTERIOR       7
01771 #define AY_STEXTERIOR       8
01772 #define AY_STATMOSPHERE     9
01773 
01777 #define AY_SASCALAR  0
01778 #define AY_SAPOINT   1
01779 #define AY_SANORMAL  2
01780 #define AY_SAVECTOR  3
01781 #define AY_SACOLOR   4
01782 #define AY_SASTRING  5
01783 #define AY_SAMATRIX  6
01784 
01788 #define AY_LITCUSTOM    0
01789 #define AY_LITPOINT     1
01790 #define AY_LITDISTANT   2
01791 #define AY_LITSPOT      3
01792 
01796 #define AY_CTOPEN     0
01797 #define AY_CTCLOSED   1
01798 #define AY_CTPERIODIC 2
01799 
01803 #define AY_KTBEZIER    0
01804 #define AY_KTBSPLINE   1
01805 #define AY_KTNURB      2
01806 #define AY_KTCUSTOM    3
01807 #define AY_KTCHORDAL   4
01808 #define AY_KTCENTRI    5
01809 #define AY_KTUNIFORM   6
01810 
01814 #define AY_PTBILINEAR  0
01815 #define AY_PTBICUBIC   1
01816 
01820 #define AY_BTBEZIER     0
01821 #define AY_BTBSPLINE    1
01822 #define AY_BTCATMULLROM 2
01823 #define AY_BTHERMITE    3
01824 #define AY_BTCUSTOM     4
01825 
01829 #define AY_SDSCATMULL    0
01830 #define AY_SDSLOOP       1
01831 
01835 #define AY_SDTHOLE    0
01836 #define AY_SDTCORNER  1
01837 #define AY_SDTCREASE  2
01838 #define AY_SDTIB      3
01839 
01843 #define AY_PRTDREADA  0 
01844 #define AY_PRTRUNPROG 1 
01845 #define AY_PRTDYNLOAD 2 
01847 
01848 
01850 #define AY_POINTER 8
01851 
01853 #define AY_EPSILON 1.0e-06
01854 
01857 #define AY_NORTH  0
01858 #define AY_EAST   1
01859 #define AY_SOUTH  2
01860 #define AY_WEST   3
01861 
01865 #define AY_XY  0
01866 #define AY_YZ  1
01867 #define AY_XZ  2
01868 
01872 #ifdef M_PI
01873  #define AY_PI M_PI
01874  #define AY_HALFPI (M_PI/2.0)
01875 #else
01876  #define AY_PI 3.1415926535897932384626433
01877  #define AY_HALFPI (3.1415926535897932384626433/2.0)
01878 #endif
01879 
01880 #define AY_D2R(x) ((x)*AY_PI/180.0)
01881 
01882 #define AY_R2D(x) ((x)*180.0/AY_PI)
01883 
01884 #define AY_COT(x) (cos(x)/sin(x))
01885 
01889 #define AY_VLEN(x,y,z) sqrt((x*x)+(y*y)+(z*z))
01890 
01891 #define AY_V3LEN(v) sqrt((v[0]*v[0])+(v[1]*v[1])+(v[2]*v[2]))
01892 
01893 #define AY_V2LEN(v) sqrt((v[0]*v[0])+(v[1]*v[1]))
01894 
01895 #define AY_V3ZERO(v) {v[0]=0.0; v[1]=0.0; v[2]=0.0;}
01896 
01897 #define AY_V3SUB(r,v1,v2) {r[0]=v1[0]-v2[0];r[1]=v1[1]-v2[1];r[2]=v1[2]-v2[2];}
01898 
01899 #define AY_V3ADD(r,v1,v2) {r[0]=v1[0]+v2[0];r[1]=v1[1]+v2[1];r[2]=v1[2]+v2[2];}
01900 
01901 #define AY_V3MUL(r,v1,v2) {r[0]=v1[0]*v2[0];r[1]=v1[1]*v2[1];r[2]=v1[2]*v2[2];}
01902 
01903 #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]);}
01904 
01905 #define AY_V3SCAL(v,f) {(v[0])*=(f);(v[1])*=(f);(v[2])*=(f);}
01906 
01907 #define AY_V2SCAL(v,f) {(v[0])*=(f);(v[1])*=(f);}
01908 
01909 #define AY_V3DOT(v1,v2) (v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2])
01910 
01911 #define AY_V2DOT(v1,v2) (v1[0]*v2[0] + v1[1]*v2[1])
01912 
01913 #define AY_V4COMP(v1, v2) ((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
01914                            (fabs(v1[1]-v2[1]) < AY_EPSILON) &&\
01915                            (fabs(v1[2]-v2[2]) < AY_EPSILON) &&\
01916                            (fabs(v1[3]-v2[3]) < AY_EPSILON))
01917 
01918 #define AY_V3COMP(v1, v2) ((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
01919                            (fabs(v1[1]-v2[1]) < AY_EPSILON) &&\
01920                            (fabs(v1[2]-v2[2]) < AY_EPSILON))
01921 
01922 #define AY_V2COMP(v1, v2) ((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
01923                            (fabs(v1[1]-v2[1]) < AY_EPSILON))
01924 
01927 /* Warning: v1 and v2 must be different locations in memory! */
01929 #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];}
01930 
01931 /* Warning: v1 and v2 must be different locations in memory! */
01933 #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];}
01934 
01936 #define AY_M44(m,r,c) ((m)[(c)*4+(r)])
01937 
01939 #define AY_ISTRAFO(o) ((fabs(o->movx) > AY_EPSILON) ||\
01940                        (fabs(o->movy) > AY_EPSILON) ||\
01941                        (fabs(o->movz) > AY_EPSILON) ||\
01942                        (fabs(o->quat[0]) > AY_EPSILON) ||\
01943                        (fabs(o->quat[1]) > AY_EPSILON) ||\
01944                        (fabs(o->quat[2]) > AY_EPSILON) ||\
01945                        (fabs(1.0 - o->quat[3]) > AY_EPSILON) ||\
01946                        (fabs(1.0 - o->scalx) > AY_EPSILON) ||\
01947                        (fabs(1.0 - o->scaly) > AY_EPSILON) ||\
01948                        (fabs(1.0 - o->scalz) > AY_EPSILON))
01949 
01951 #define AY_CHTCLERRRET(stat,name,interp) if(stat){\
01952           ay_error(AY_ERROR, name, Tcl_GetStringResult(interp));\
01953           Tcl_ResetResult(interp);\
01954           return TCL_OK;}
01955 
01957 #define AY_CHTCLERRGOT(stat,name,interp) if(stat){\
01958           ay_error(AY_ERROR, name, Tcl_GetStringResult(interp));\
01959           Tcl_ResetResult(interp);\
01960           goto cleanup;}
01961 
01964 #define AY_VERSIONSTR "1.20"
01965 #define AY_VERSIONSTRMI "0"
01966 
01967 #define AY_VERSIONMA 1
01968 #define AY_VERSION   20
01969 #define AY_VERSIONMI 0
01970 
01972 /* Ayam API */
01973 #include "aycore.h"
01974 #include "nurbs.h"
01975 #include "objects.h"
01976 #include "contrib.h"
01977 
01996 #ifdef __cplusplus
01997 }
01998 #endif /* __cplusplus */
01999 
02000 #endif /* __ayam_h__ */
02001 

Generated on Fri Mar 30 2012 19:53:01 for Ayam by  doxygen 1.7.1