22 VisRTX::Context* rtx = VisRTX_GetContext();
23 this->renderer = rtx->CreateRenderer();
25 this->renderer->SetToneMapping(
false);
30 this->renderer->Release();
36 Model* model = this->GetObject<Model>({
"model" });
38 this->renderer->SetModel(model->model);
41 Camera* camera = this->GetObject<Camera>({
"camera" });
43 this->renderer->SetCamera(camera->camera);
46 for (VisRTX::Light* light : this->lastLights)
47 this->renderer->RemoveLight(light);
49 this->lastLights.clear();
51 Data* lightData = this->GetObject<Data>({
"lights" });
57 Light* lightHandle = lights[i];
60 VisRTX::Light* light = lightHandle->light;
61 this->renderer->AddLight(light);
62 this->lastLights.push_back(light);
69 if (this->
Get1i({
"spp" }, &spp))
70 this->renderer->SetSamplesPerPixel(spp);
74 if (this->
Get1f({
"epsilon" }, &epsilon))
75 this->renderer->SetEpsilon(epsilon);
78 int32_t minBounces = this->
Get1i({
"rouletteDepth" }, 5);
79 int32_t maxBounces = this->
Get1i({
"maxDepth" }, 10);
80 this->renderer->SetNumBounces(minBounces, maxBounces);
83 int denoise = this->
Get1i({
"denoise" });
84 this->renderer->SetDenoiser(denoise > 0 ? VisRTX::DenoiserType::AI : VisRTX::DenoiserType::NONE);
94 this->renderer->Render(frameBuffer->frameBuffer);
96 catch (VisRTX::Exception& e)
98 std::cerr <<
"VisRTX internal error: " << e.what() << std::endl;
102 return std::numeric_limits<float>::infinity();
106 VisRTX::Renderer* renderer =
nullptr;
108 std::vector<VisRTX::Light*> lastLights;
RTWDataType GetDataType() const
float RenderFrame(FrameBuffer *frameBuffer, const uint32_t)
int32_t Get1i(const std::vector< std::string > &ids, int32_t defaultValue=0, bool *found=nullptr) const
float Get1f(const std::vector< std::string > &ids, float defaultValue=0.0f, bool *found=nullptr) const
size_t GetNumElements() const