00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00037 #ifndef LIBANARIDISPLAYDEVICE
00038 #define LIBANARIDISPLAYDEVICE
00039
00040 #include <stdio.h>
00041 #include "Matrix4.h"
00042 #include "FileRenderer.h"
00043 #include "WKFUtils.h"
00044
00046 class ANARIRender;
00047
00049 class ANARIDisplayDevice: public FileRenderer {
00050 private:
00051 int isinteractive;
00052 ANARIRender * ort;
00053 wkf_timerhandle ort_timer;
00054
00055 void reset_vars(void);
00056 void write_lights(void);
00057 void write_materials(void);
00058 void add_material(void);
00059
00060 #if 0
00061
00062 int involtex;
00063 int voltexID;
00064 float xplaneeq[4];
00065 float yplaneeq[4];
00066 float zplaneeq[4];
00067
00068
00069 int inclipgroup;
00070 #endif
00071
00072 #if 0
00073
00074
00075
00076 int cylinder_matindex;
00077 Matrix4 *cylinder_xform;
00078 float cylinder_radius_scalefactor;
00079 ResizeArray<float> cylinder_vert_buffer;
00080 ResizeArray<float> cylinder_radii_buffer;
00081 ResizeArray<float> cylinder_color_buffer;
00082
00083 ResizeArray<float> cylcap_vert_buffer;
00084 ResizeArray<float> cylcap_norm_buffer;
00085 ResizeArray<float> cylcap_radii_buffer;
00086 ResizeArray<float> cylcap_color_buffer;
00087
00089 void reset_cylinder_buffer() {
00090 cylinder_matindex = -1;
00091 cylinder_xform = NULL;
00092 cylinder_radius_scalefactor=1.0f;
00093 cylinder_vert_buffer.clear();
00094 cylinder_radii_buffer.clear();
00095 cylinder_color_buffer.clear();
00096
00097 cylcap_vert_buffer.clear();
00098 cylcap_norm_buffer.clear();
00099 cylcap_radii_buffer.clear();
00100 cylcap_color_buffer.clear();
00101 };
00102 #endif
00103
00104
00105
00106
00107 int triangle_cindex;
00108 int triangle_matindex;
00109 Matrix4 *triangle_xform;
00110 ResizeArray<float> triangle_vert_buffer;
00111 ResizeArray<float> triangle_norm_buffer;
00112
00114 void reset_triangle_buffer() {
00115 triangle_cindex = -1;
00116 triangle_matindex = -1;
00117 triangle_xform = NULL;
00118 triangle_vert_buffer.clear();
00119 triangle_norm_buffer.clear();
00120 };
00121
00122 protected:
00123 #if 0
00124 void send_cylinder_buffer(void);
00125 void cylinder(float *, float *, float rad, int filled);
00126 void text(float *pos, float size, float thickness, const char *str);
00127 #endif
00128
00130 void comment(const char *);
00131
00132 #if 0
00133 void sphere(float *spdata);
00134 #endif
00135 void sphere_array(int num, int res, float *centers,
00136 float *radii, float *colors);
00137 void send_triangle_buffer(void);
00138 void triangle(const float *, const float *, const float *,
00139 const float *, const float *, const float *);
00140 void tricolor(const float * xyz1, const float * xyz2, const float * xyz3,
00141 const float * n1, const float * n2, const float * n3,
00142 const float * c1, const float * c2, const float * c3);
00143 void trimesh_c4u_n3b_v3f(unsigned char *c, signed char *n, float *v, int numfacets);
00144 void trimesh_c4u_n3f_v3f(unsigned char *c, float *n, float *v, int numfacets);
00145 void trimesh_c4n3v3(int numverts, float * cnv, int numfacets, int * facets);
00146 void trimesh_n3b_v3f(signed char *n, float *v, int numfacets);
00147 void trimesh_n3f_v3f(float *n, float *v, int numfacets);
00148 #if 0
00149 void trimesh_n3fopt_v3f(float *n, float *v, int numfacets);
00150 #endif
00151 void tristrip(int numverts, const float * cnv,
00152 int numstrips, const int *vertsperstrip,
00153 const int *facets);
00154
00155 public:
00156 static void ANARI_Global_Init(void);
00157 static void ANARI_Global_Shutdown(void);
00158 ANARIDisplayDevice(VMDApp *, int interactive);
00159 virtual ~ANARIDisplayDevice(void);
00160 void write_header(void);
00161 void write_trailer(void);
00162 };
00163
00164 #endif
00165