NVIDIAGameWorks / Falcor

Real-Time Rendering Framework
https://developer.nvidia.com/falcor
Other
2.54k stars 464 forks source link

Bugfix: locale float to_string #419

Closed steimich96 closed 1 month ago

steimich96 commented 4 months ago

This is fixes a bug that leads to a compile error when the local system uses a comma (",") instead of dot (".") as decimal-point (e.g., in German).

Scene.cpp: defines.add("SCENE_DIFFUSE_ALBEDO_MULTIPLIER", std::to_string(mRenderSettings.diffuseAlbedoMultiplier));

StandardMaterial.slang: d.diffuse = saturate(d.diffuse * SCENE_DIFFUSE_ALBEDO_MULTIPLIER);

Example: std::cout << std::to_string(mRenderSettings.diffuseAlbedoMultiplier) << " vs. " << fmt::format("{:f}", RenderSettings.diffuseAlbedoMultiplier) << std::endl;

Output: 1,000000 vs. 1.000000

steimich96 commented 4 months ago

Do not merge yet. Found another one:

defines.add("MIS_POWER_EXPONENT", std::to_string(misPowerExponent));