diff --git a/src/editor/src/texture3d/image3d.cpp b/src/editor/src/texture3d/image3d.cpp index db763051..9df8d815 100644 --- a/src/editor/src/texture3d/image3d.cpp +++ b/src/editor/src/texture3d/image3d.cpp @@ -291,7 +291,11 @@ void Image3DWidget::browse_filename() if(new_filename.isEmpty()) return; - std::ifstream fin(new_filename.toStdString(), std::ios::in); + std::ifstream fin(new_filename.toStdString()); + if(!fin) + throw tracer::ObjectConstructionException( + "failed to open file: " + new_filename.toStdString()); + new_real_data = tracer::toRC( tracer::texture3d_load::load_real_from_ascii(fin)); diff --git a/src/tracer/src/core/material/disney.cpp b/src/tracer/src/core/material/disney.cpp index 2961d631..65c57d43 100644 --- a/src/tracer/src/core/material/disney.cpp +++ b/src/tracer/src/core/material/disney.cpp @@ -603,7 +603,7 @@ namespace disney_impl { if(sam_selector < sample_w.transmission) lwi = sample_transmission(lwo, new_sam); - else if(sam_selector -= sample_w.specular; + else if(sam_selector -= sample_w.transmission; sam_selector < sample_w.specular) lwi = sample_specular(lwo, new_sam); else diff --git a/src/tracer/src/core/material/dream_works_fabric.cpp b/src/tracer/src/core/material/dream_works_fabric.cpp index 5fb90d1f..1a0acbb1 100644 --- a/src/tracer/src/core/material/dream_works_fabric.cpp +++ b/src/tracer/src/core/material/dream_works_fabric.cpp @@ -91,7 +91,7 @@ namespace return {}; const FVec3 lwh = (lwi + lwo).normalize(); - const real S = std::pow(1 - std::abs(lwh.x), n_); + const real S = std::pow(1 - std::abs(lwh.x), static_cast(n_)); return color_ * S / Io[n_]; } @@ -139,7 +139,8 @@ namespace // construct result - const real S = std::pow(1 - std::abs(sin_theta_h), n_); + const real S = std::pow( + 1 - std::abs(sin_theta_h), static_cast(n_)); SampleResult ret; ret.f = color_ * S / Io[n_]; @@ -157,7 +158,8 @@ namespace const FVec3 lwh = (lwi + lwo).normalize(); const real sin_theta_h = lwh.x; - const real S = std::pow(1 - std::abs(sin_theta_h), n_); + const real S = std::pow( + 1 - std::abs(sin_theta_h), static_cast(n_)); return real(n_ + 1) * S / (8 * PI_r * dot(lwi, lwh)); } diff --git a/src/tracer/src/core/material/utility/microfacet.h b/src/tracer/src/core/material/utility/microfacet.h index ad1fe834..f5074f84 100644 --- a/src/tracer/src/core/material/utility/microfacet.h +++ b/src/tracer/src/core/material/utility/microfacet.h @@ -10,7 +10,7 @@ namespace microfacet inline real one_minus_5(real x) noexcept { real t = 1 - x, t2 = t * t; return t2 * t2 * t; - } + } real gtr2(real cos_theta_h, real alpha) noexcept;