21VTK_ABI_NAMESPACE_BEGIN
28 VisRTX::Context* rtx = VisRTX_GetContext();
29 this->renderer = rtx->CreateRenderer();
31 this->renderer->SetToneMapping(
false);
36 this->renderer->Release();
51 this->renderer->SetCamera(camera->camera);
54 Data *map_backplate = GetObject<Data>({
"map_backplate"});
55 Light bgLight(
"hdri");
56 bgLight.SetVec3f(
"dir", 1.0, 0.0, 0.0);
57 bgLight.SetVec3f(
"up", 0.0, 1.0, 0.0);
58 bgLight.SetObject(
"map", map_backplate);
61 bool removeTemp =
false;
67 VisRTX::Model *model = world->model;
68 this->renderer->SetModel(model);
71 for (VisRTX::Light* light : this->lastLights)
72 this->renderer->RemoveLight(light);
74 this->lastLights.clear();
86 Light* lightHandle = lights[i];
89 VisRTX::Light* light = lightHandle->light;
90 this->renderer->AddLight(light);
91 this->lastLights.push_back(light);
99 this->renderer->AddLight(bgLight.light);
106 if (this->
GetInt({
"pixelSamples" }, &spp))
108 this->renderer->SetSamplesPerPixel(spp);
113 if (this->
GetFloat({
"epsilon" }, &epsilon))
115 this->renderer->SetEpsilon(epsilon);
119 int32_t minBounces = this->
GetInt({
"rouletteDepth" }, 5);
120 int32_t maxBounces = this->
GetFloat({
"maxPathLength" }, 10.0f);
121 this->renderer->SetNumBounces(minBounces, maxBounces);
124 int denoise = this->
GetInt({
"denoise" });
125 this->renderer->SetDenoiser(denoise > 0 ? VisRTX::DenoiserType::AI : VisRTX::DenoiserType::NONE);
130 this->renderer->Render(frameBuffer->frameBuffer);
132 catch (VisRTX::Exception& e)
134 vtkLogF(ERROR,
"VisRTX internal error: \"%s\"", e.what());
138 this->renderer->RemoveLight(bgLight.light);
141 return std::numeric_limits<float>::infinity();
145 VisRTX::Renderer* renderer =
nullptr;
147 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.