MCPcopy Create free account
hub / github.com/RenderKit/embree / Tutorial

Method Tutorial

tutorials/viewer/viewer.cpp:35–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 struct Tutorial : public SceneLoadingTutorialApplication
34 {
35 Tutorial()
36 : SceneLoadingTutorialApplication(NAME,FEATURES)
37 {
38#if RTC_MIN_WIDTH
39 registerOption("min-width", [] (Ref<ParseStream> cin, const FileName& path) {
40 g_min_width = cin->getFloat();
41 g_min_width_max_radius_scale = cin->getFloat();
42 }, "--min-width <float> <float>: first value sets number of pixel to enlarge curve and point geometry to, but maximally scales hair radii by second value");
43#endif
44
45 registerOption("shader", [] (Ref<ParseStream> cin, const FileName& path) {
46 std::string mode = cin->getString();
47 if (mode == "default" ) shader = SHADER_DEFAULT;
48 else if (mode == "eyelight") shader = SHADER_EYELIGHT;
49 else if (mode == "occlusion") shader = SHADER_OCCLUSION;
50 else if (mode == "uv" ) shader = SHADER_UV;
51 else if (mode == "texcoords") shader = SHADER_TEXCOORDS;
52 else if (mode == "texcoords-grid") shader = SHADER_TEXCOORDS_GRID;
53 else if (mode == "Ng" ) shader = SHADER_NG;
54 else if (mode == "cycles" ) { shader = SHADER_CYCLES; scale = cin->getFloat(); }
55 else if (mode == "geomID" ) shader = SHADER_GEOMID;
56 else if (mode == "primID" ) shader = SHADER_GEOMID_PRIMID;
57 else if (mode == "ao" ) shader = SHADER_AO;
58 else throw std::runtime_error("invalid shader:" +mode);
59 },
60 "--shader <string>: sets shader to use at startup\n"
61 " default: default tutorial shader\n"
62 " eyelight: eyelight shading\n"
63 " occlusion: occlusion shading\n"
64 " uv: uv debug shader\n"
65 " texcoords: texture coordinate debug shader\n"
66 " texcoords-grid: grid texture debug shader\n"
67 " Ng: visualization of shading normal\n"
68 " cycles <float>: CPU cycle visualization\n"
69 " ao: ambient occlusion\n"
70 " geomID: visualization of geometry ID\n"
71 " primID: visualization of geometry and primitive ID");
72
73#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION)
74 registerOption("features", [] (Ref<ParseStream> cin, const FileName& path) {
75 g_use_scene_features = false;
76 unsigned int feature_mask = RTC_FEATURE_FLAG_NONE;
77 while (cin->peek() != "" && cin->peek()[0] != '-') {
78 std::string feature = cin->getString();
79 std::transform(feature.begin(), feature.end(), feature.begin(), [](unsigned char c){ return toupper(c); });
80 if (feature == "MOTION_BLUR") feature_mask |= RTC_FEATURE_FLAG_MOTION_BLUR;
81 else if (feature == "TRIANGLE") feature_mask |= RTC_FEATURE_FLAG_TRIANGLE;
82 else if (feature == "QUAD") feature_mask |= RTC_FEATURE_FLAG_QUAD;
83 else if (feature == "GRID") feature_mask |= RTC_FEATURE_FLAG_GRID;
84 else if (feature == "SUBDIVISION") feature_mask |= RTC_FEATURE_FLAG_SUBDIVISION;
85 else if (feature == "CONE_LINEAR_CURVE" ) feature_mask |= RTC_FEATURE_FLAG_CONE_LINEAR_CURVE;
86 else if (feature == "ROUND_LINEAR_CURVE") feature_mask |= RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE;
87 else if (feature == "FLAT_LINEAR_CURVE" ) feature_mask |= RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE;
88 else if (feature == "ROUND_BEZIER_CURVE") feature_mask |= RTC_FEATURE_FLAG_ROUND_BEZIER_CURVE;
89 else if (feature == "FLAT_BEZIER_CURVE") feature_mask |= RTC_FEATURE_FLAG_FLAT_BEZIER_CURVE;
90 else if (feature == "NORMAL_ORIENTED_BEZIER_CURVE") feature_mask |= RTC_FEATURE_FLAG_NORMAL_ORIENTED_BEZIER_CURVE;
91 else if (feature == "ROUND_BSPLINE_CURVE") feature_mask |= RTC_FEATURE_FLAG_ROUND_BSPLINE_CURVE;
92 else if (feature == "FLAT_BSPLINE_CURVE") feature_mask |= RTC_FEATURE_FLAG_FLAT_BSPLINE_CURVE;

Callers

nothing calls this directly

Calls 4

getFloatMethod · 0.45
getStringMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected