File indexing completed on 2026-04-09 07:49:02
0001 #pragma once
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <vector>
0014 #include "scuda.h"
0015 #include "squad.h"
0016 #include "plog/Severity.h"
0017
0018 struct SIMG ;
0019 #include "CSGOPTIX_API_EXPORT.hh"
0020
0021 struct CSGOPTIX_API Frame
0022 {
0023 static const plog::Severity LEVEL ;
0024
0025 unsigned mask ;
0026 int width ;
0027 int height ;
0028 int depth ;
0029 int channels ;
0030 int jpg_quality ;
0031
0032 SIMG* img ;
0033 unsigned num_pixels ;
0034
0035 std::vector<float4> isect ;
0036 std::vector<uchar4> pixel ;
0037 #ifdef WITH_FRAME_PHOTON
0038 std::vector<quad4> fphoton ;
0039 #endif
0040
0041 template<typename T>
0042 static T* DeviceAlloc(unsigned num_pixels, bool enabled );
0043
0044 uchar4* d_pixel ;
0045 float4* d_isect ;
0046 #ifdef WITH_FRAME_PHOTON
0047 quad4* d_fphoton ;
0048 #else
0049 quad4* d_dummy ;
0050 #endif
0051
0052 public:
0053 Frame(int width_, int height_, int depth_, uchar4* d_pixel_=nullptr, float4* d_isect_=nullptr, quad4* d_fphoton_=nullptr );
0054 void setExternalDevicePixels(uchar4* _d_pixel );
0055 void download_(bool flip_vertical);
0056 void download();
0057 void download_inverted();
0058 void annotate( const char* bottom_line=nullptr, const char* top_line=nullptr, int line_height=24 );
0059 void snap(const char* path );
0060
0061 private:
0062
0063 void write(const char* outdir, int quality=0) const ;
0064
0065 void writePNG(const char* path) const ;
0066 void writePNG(const char* dir, const char* name) const ;
0067
0068 void writeJPG(const char* path, int quality=0) const ;
0069 void writeJPG(const char* dir, const char* name, int quality=0) const ;
0070
0071 void writeIsect( const char* dir, const char* name) const ;
0072
0073
0074 unsigned getNumPixels() const ;
0075 unsigned char* getPixelData() const ;
0076 float* getIntersectData() const ;
0077
0078 #ifdef WITH_FRAME_PHOTON
0079 void writeFPhoton( const char* dir, const char* name) const ;
0080 float* getFPhotonData() const ;
0081 #endif
0082
0083 };
0084