Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OptiXDisplayDevice.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010 * RCS INFORMATION:
00011 *
00012 *      $RCSfile: OptiXDisplayDevice.h,v $
00013 *      $Author: johns $      $Locker:  $               $State: Exp $
00014 *      $Revision: 1.33 $         $Date: 2020/11/17 20:34:02 $
00015 *
00016 ***************************************************************************/
00075 #ifndef LIBOPTIXDISPLAYDEVICE
00076 #define LIBOPTIXDISPLAYDEVICE
00077 
00078 #include <stdio.h>
00079 #include "Matrix4.h"
00080 #include "FileRenderer.h"
00081 #include "WKFUtils.h" // timers
00082 
00084 class OptiXRenderer;
00085 
00087 class OptiXDisplayDevice: public FileRenderer {
00088 private:
00089   int isinteractive;
00090   OptiXRenderer * ort;
00091   wkf_timerhandle ort_timer;
00092 
00093   void reset_vars(void); 
00094   void write_lights(void);
00095   void write_materials(void);
00096   void add_material(void);
00097 
00098 #if 0
00099   // state tracking for volumetric texturing
00100   int involtex;               
00101   int voltexID;               
00102   float xplaneeq[4];          
00103   float yplaneeq[4];
00104   float zplaneeq[4];
00105 
00106   // state tracking for user-defined clipping planes
00107   int inclipgroup;            
00108 #endif
00109 
00110   // storage and state variables needed to aggregate lone cylinders
00111   // with common color and material state into a larger buffer for
00112   // transmission to OptiX
00113   int cylinder_matindex;
00114   Matrix4 *cylinder_xform;
00115   float cylinder_radius_scalefactor;
00116   ResizeArray<float> cylinder_vert_buffer;
00117   ResizeArray<float> cylinder_radii_buffer;
00118   ResizeArray<float> cylinder_color_buffer;
00119   // cylinder end caps, made from rings
00120   ResizeArray<float> cylcap_vert_buffer;
00121   ResizeArray<float> cylcap_norm_buffer;
00122   ResizeArray<float> cylcap_radii_buffer;
00123   ResizeArray<float> cylcap_color_buffer;
00124   
00125 
00127   void reset_cylinder_buffer() {
00128     cylinder_matindex = -1; 
00129     cylinder_xform = NULL;
00130     cylinder_radius_scalefactor=1.0f; 
00131     cylinder_vert_buffer.clear();
00132     cylinder_radii_buffer.clear();
00133     cylinder_color_buffer.clear();
00134 
00135     cylcap_vert_buffer.clear();
00136     cylcap_norm_buffer.clear();
00137     cylcap_radii_buffer.clear();
00138     cylcap_color_buffer.clear();
00139   };
00140 
00141 
00142   // storage and state variables needed to aggregate lone spheres
00143   // with common color and material state into a larger buffer for
00144   // transmission to OptiX
00145   int sphere_matindex;
00146   Matrix4 *sphere_xform;
00147   float sphere_radius_scalefactor;
00148   ResizeArray<float> sphere_vert_buffer;
00149   ResizeArray<float> sphere_radii_buffer;
00150   ResizeArray<float> sphere_color_buffer;
00151 
00152 
00154   void reset_sphere_buffer() {
00155     sphere_matindex = -1; 
00156     sphere_xform = NULL;
00157     sphere_radius_scalefactor=1.0f; 
00158     sphere_vert_buffer.clear();
00159     sphere_radii_buffer.clear();
00160     sphere_color_buffer.clear();
00161   };
00162 
00163 
00164   // storage and state variables needed to aggregate lone triangles
00165   // with common color and material state into a larger buffer for
00166   // transmission to OptiX
00167   int triangle_cindex;
00168   int triangle_matindex;
00169   Matrix4 *triangle_xform;
00170   ResizeArray<float> triangle_vert_buffer;
00171   ResizeArray<float> triangle_norm_buffer;
00172 
00174   void reset_triangle_buffer() {
00175     triangle_cindex = -1;   
00176     triangle_matindex = -1; 
00177     triangle_xform = NULL;
00178     triangle_vert_buffer.clear();
00179     triangle_norm_buffer.clear();
00180   };
00181 
00182 protected:
00183   void send_cylinder_buffer(void);
00184   void send_sphere_buffer(void);
00185   void send_triangle_buffer(void);
00186 
00187   void cylinder(float *, float *, float rad, int filled);
00188   void sphere(float *xyzr);
00189   void sphere_array(int num, int res, float *centers, 
00190                     float *radii, float *colors);
00191   void text(float *pos, float size, float thickness, const char *str);
00192   void triangle(const float *, const float *, const float *,
00193                 const float *, const float *, const float *);
00194   void tricolor(const float * xyz1, const float * xyz2, const float * xyz3,
00195                 const float * n1,   const float * n2,   const float * n3,
00196                 const float * c1,   const float * c2,   const float * c3);
00197   void trimesh_c4u_n3b_v3f(unsigned char *c, signed char *n, float *v, int numfacets);
00198   void trimesh_c4u_n3f_v3f(unsigned char *c, float *n, float *v, int numfacets);
00199   void trimesh_c4n3v3(int numverts, float * cnv, int numfacets, int * facets);
00200   void trimesh_n3b_v3f(signed char *n, float *v, int numfacets);
00201   void trimesh_n3f_v3f(float *n, float *v, int numfacets);
00202   void trimesh_n3fopt_v3f(float *n, float *v, int numfacets);
00203   void tristrip(int numverts, const float * cnv,
00204                 int numstrips, const int *vertsperstrip,
00205                 const int *facets);
00206 
00207 public: 
00208   OptiXDisplayDevice(VMDApp *, int interactive);
00209   virtual ~OptiXDisplayDevice(void);
00210 
00212   static unsigned int device_count(void);
00213 
00214   void write_header(void); 
00215   void write_trailer(void);
00216 }; 
00217 
00218 #endif
00219 

Generated on Thu Apr 18 02:45:04 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002