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

OSPRay2DisplayDevice.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: OSPRay2DisplayDevice.h,v $
00013 *      $Author: johns $      $Locker:  $               $State: Exp $
00014 *      $Revision: 1.5 $         $Date: 2021/12/13 07:54:00 $
00015 *
00016 ***************************************************************************/
00038 #ifndef LIBOSPRAY2DISPLAYDEVICE
00039 #define LIBOSPRAY2DISPLAYDEVICE
00040 
00041 #include <stdio.h>
00042 #include "Matrix4.h"
00043 #include "FileRenderer.h"
00044 #include "WKFUtils.h" // timers
00045 
00047 class OSPRay2Renderer;
00048 
00050 class OSPRay2DisplayDevice: public FileRenderer {
00051 private:
00052   int isinteractive;
00053   OSPRay2Renderer * ort;
00054   wkf_timerhandle ort_timer;
00055 
00056   void reset_vars(void); 
00057   void write_lights(void);
00058   void write_materials(void);
00059   void add_material(void);
00060 
00061   int inclipgroup;            
00062 #if 0
00063   int involtex;               
00064   int voltexID;               
00065   float xplaneeq[4];          
00066   float yplaneeq[4];
00067   float zplaneeq[4];
00068 #endif
00069 
00070 #if 1
00071   // storage and state variables needed to aggregate lone cylinders
00072   // with common color and material state into a larger buffer for
00073   // transmission to OSPRay
00074   int cylinder_matindex;
00075   Matrix4 *cylinder_xform;
00076   float cylinder_radius_scalefactor;
00077   ResizeArray<float> cylinder_vert_buffer;
00078   ResizeArray<float> cylinder_radii_buffer;
00079   ResizeArray<float> cylinder_color_buffer;
00080   // cylinder end caps, made from rings
00081   ResizeArray<float> cylcap_vert_buffer;
00082   ResizeArray<float> cylcap_norm_buffer;
00083   ResizeArray<float> cylcap_radii_buffer;
00084   ResizeArray<float> cylcap_color_buffer;
00085 
00087   void reset_cylinder_buffer() {
00088     cylinder_matindex = -1;
00089     cylinder_xform = NULL;
00090     cylinder_radius_scalefactor=1.0f;
00091     cylinder_vert_buffer.clear();
00092     cylinder_radii_buffer.clear();
00093     cylinder_color_buffer.clear();
00094 
00095     cylcap_vert_buffer.clear();
00096     cylcap_norm_buffer.clear();
00097     cylcap_radii_buffer.clear();
00098     cylcap_color_buffer.clear();
00099   };
00100 #endif
00101 
00102   // storage and state variables needed to aggregate lone triangles
00103   // with common color and material state into a larger buffer for
00104   // transmission to OSPRay
00105   int triangle_cindex;
00106   int triangle_matindex;
00107   Matrix4 *triangle_xform;
00108   ResizeArray<float> triangle_vert_buffer;
00109   ResizeArray<float> triangle_norm_buffer;
00110 
00112   void reset_triangle_buffer() {
00113     triangle_cindex = -1;   
00114     triangle_matindex = -1; 
00115     triangle_xform = NULL;
00116     triangle_vert_buffer.clear();
00117     triangle_norm_buffer.clear();
00118   };
00119 
00120 protected:
00121 #if 1
00122   void send_cylinder_buffer(void);
00123   void cylinder(float *, float *, float rad, int filled);
00124   void text(float *pos, float size, float thickness, const char *str);
00125 #endif
00126 
00127 #if 0
00128   void sphere(float *spdata);
00129 #endif
00130   void sphere_array(int num, int res, float *centers, 
00131                     float *radii, float *colors);
00132   void send_triangle_buffer(void);
00133   void triangle(const float *, const float *, const float *,
00134                 const float *, const float *, const float *);
00135   void tricolor(const float * xyz1, const float * xyz2, const float * xyz3,
00136                 const float * n1,   const float * n2,   const float * n3,
00137                 const float * c1,   const float * c2,   const float * c3);
00138   void trimesh_c4u_n3b_v3f(unsigned char *c, signed char *n, float *v, int numfacets);
00139   void trimesh_c4u_n3f_v3f(unsigned char *c, float *n, float *v, int numfacets);
00140   void trimesh_c4n3v3(int numverts, float * cnv, int numfacets, int * facets);
00141   void trimesh_n3b_v3f(signed char *n, float *v, int numfacets);
00142   void trimesh_n3f_v3f(float *n, float *v, int numfacets);
00143 #if 0
00144   void trimesh_n3fopt_v3f(float *n, float *v, int numfacets);
00145 #endif
00146   void tristrip(int numverts, const float * cnv,
00147                 int numstrips, const int *vertsperstrip,
00148                 const int *facets);
00149 
00150 #if 0
00151   // define a volumetric texture map
00152   virtual void define_volume_texture(int ID, int xs, int ys, int zs,
00153                                      const float *xplaneeq,
00154                                      const float *yplaneeq,
00155                                      const float *zplaneeq,
00156                                      unsigned char *texmap);
00157 
00158   // enable volumetric texturing, either in "replace" or "modulate" mode
00159   virtual void volume_texture_on(int texmode);
00160 
00161   // disable volumetric texturing
00162   virtual void volume_texture_off(void);
00163 
00164   // begin a group of objects to be clipped by the same set of
00165   // clipping planes
00166   void start_clipgroup(void);
00167   void end_clipgroup(void);
00168 #endif
00169 
00170 public: 
00171   static int OSPRay_Global_Init(void);      
00172   static void OSPRay_Global_Shutdown(void); 
00173   OSPRay2DisplayDevice(VMDApp *, int interactive);
00174   virtual ~OSPRay2DisplayDevice(void);
00175   void write_header(void); 
00176   void write_trailer(void);
00177 }; 
00178 
00179 #endif
00180 

Generated on Fri Nov 8 02:45:15 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002