25 VisRTX::Context* rtx = VisRTX_GetContext();
26 this->renderer = rtx->CreateRenderer();
28 this->renderer->SetToneMapping(
false);
33 this->renderer->Release();
49 this->renderer->SetCamera(camera->camera);
52 Data *map_backplate = GetObject<Data>({
"map_backplate"});
53 Light bgLight(
"hdri");
54 bgLight.SetVec3f(
"dir", 1.0, 0.0, 0.0);
55 bgLight.SetVec3f(
"up", 0.0, 1.0, 0.0);
56 bgLight.SetObject(
"map", map_backplate);
59 bool removeTemp =
false;
65 VisRTX::Model *model = world->model;
66 this->renderer->SetModel(model);
69 for (VisRTX::Light* light : this->lastLights)
70 this->renderer->RemoveLight(light);
72 this->lastLights.clear();
84 Light* lightHandle = lights[i];
87 VisRTX::Light* light = lightHandle->light;
88 this->renderer->AddLight(light);
89 this->lastLights.push_back(light);
97 this->renderer->AddLight(bgLight.light);
104 if (this->
GetInt({
"pixelSamples" }, &spp))
106 this->renderer->SetSamplesPerPixel(spp);
111 if (this->
GetFloat({
"epsilon" }, &epsilon))
113 this->renderer->SetEpsilon(epsilon);
117 int32_t minBounces = this->
GetInt({
"rouletteDepth" }, 5);
118 int32_t maxBounces = this->
GetFloat({
"maxPathLength" }, 10.0f);
119 this->renderer->SetNumBounces(minBounces, maxBounces);
122 int denoise = this->
GetInt({
"denoise" });
123 this->renderer->SetDenoiser(denoise > 0 ? VisRTX::DenoiserType::AI : VisRTX::DenoiserType::NONE);
128 this->renderer->Render(frameBuffer->frameBuffer);
130 catch (VisRTX::Exception& e)
132 vtkLogF(ERROR,
"VisRTX internal error: \"%s\"", e.what());
136 this->renderer->RemoveLight(bgLight.light);
139 return std::numeric_limits<float>::infinity();
143 VisRTX::Renderer* renderer =
nullptr;
145 std::vector<VisRTX::Light*> lastLights;
size_t GetNumElements() const
RTWDataType GetElementDataType() const
RTWDataType GetDataType() const
int32_t GetInt(const std::vector< std::string > &ids, int32_t defaultValue=0, bool *found=nullptr) const
T * GetObject(const std::vector< std::string > &ids, T *defaultValue=nullptr, bool *found=nullptr) const
float GetFloat(const std::vector< std::string > &ids, float defaultValue=0.0f, bool *found=nullptr) const
float RenderFrame(FrameBuffer *frameBuffer, Camera *camera, World *world)
#define vtkLogF(verbosity_name,...)
Add to log given the verbosity level.