1 // Copyright 2016-2021 Doug Moen 2 // Licensed under the Apache License, version 2.0 3 // See accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0 4 5 #ifndef LIBCURV_RENDER_H 6 #define LIBCURV_RENDER_H 7 8 #include <libcurv/function.h> 9 #include <glm/vec3.hpp> 10 #include <vector> 11 12 namespace curv { 13 14 struct Record; 15 struct Context; 16 struct Function; 17 18 struct Render_Opts 19 { 20 enum class Shader { standard, pew, sf1 }; 21 static const std::vector<const char*> shader_enum; 22 23 // spatial anti-aliasing via supersampling. aa_==1 means it is turned off. 24 int aa_ = 1; 25 // temporal anti-aliasing. 26 int taa_ = 1; 27 // frame duration for animation, needed for TAA. 28 double fdur_ = 0.04; // 25 FPS 29 // background colour, defaults to white 30 glm::dvec3 bg_ = glm::dvec3(1.0,1.0,1.0); 31 // max # of iterations in the ray-marcher 32 int ray_max_iter_ = 200; 33 // max ray-marching distance 34 double ray_max_depth_ = 400.0; 35 // shader implementation 36 Shader shader_ = Shader::standard; 37 // sf1 shader function, configured as: shader={sf1:<function>} 38 Shared<const Function> sf1_ = nullptr; 39 40 void update_from_record(Record&, const Context&); 41 static void describe_opts(std::ostream&, const char*); 42 void set_shader(Value, const Context&); 43 bool set_field(const std::string&, Value, const Context&); 44 }; 45 46 } // namespace 47 #endif // header guard 48