Commit 77bde84f authored by Matt Pharr's avatar Matt Pharr

Fix a few MSVC warnings

parent fc161cc6
......@@ -270,8 +270,8 @@ static RGBSpectrum *ReadImagePNG(const std::string &name, int *width,
RGBSpectrum *ret = new RGBSpectrum[*width * *height];
unsigned char *src = rgb;
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x, src += 3) {
for (unsigned int y = 0; y < h; ++y) {
for (unsigned int x = 0; x < w; ++x, src += 3) {
Float c[3];
c[0] = src[0] / 255.f;
c[1] = src[1] / 255.f;
......
......@@ -66,7 +66,7 @@ std::unique_ptr<LightDistribution> CreateLightSampleDistribution(
UniformLightDistribution::UniformLightDistribution(const Scene &scene) {
std::vector<Float> prob(scene.lights.size(), Float(1));
distrib.reset(new Distribution1D(&prob[0], prob.size()));
distrib.reset(new Distribution1D(&prob[0], int(prob.size())));
}
const Distribution1D *UniformLightDistribution::Lookup(const Point3f &p) const {
......@@ -295,7 +295,7 @@ SpatialLightDistribution::ComputeDistribution(Point3i pi) const {
", avgContrib = " << avgContrib;
// Compute a sampling distribution from the accumulated contributions.
return new Distribution1D(&lightContrib[0], lightContrib.size());
return new Distribution1D(&lightContrib[0], int(lightContrib.size()));
}
} // namespace pbrt
......@@ -67,10 +67,10 @@ struct Distribution1D {
for (int i = 1; i < n + 1; ++i) cdf[i] /= funcInt;
}
}
int Count() const { return func.size(); }
int Count() const { return (int)func.size(); }
Float SampleContinuous(Float u, Float *pdf, int *off = nullptr) const {
// Find surrounding CDF segments and _offset_
int offset = FindInterval(cdf.size(),
int offset = FindInterval((int)cdf.size(),
[&](int index) { return cdf[index] <= u; });
if (off) *off = offset;
// Compute offset along CDF segment
......@@ -90,7 +90,7 @@ struct Distribution1D {
int SampleDiscrete(Float u, Float *pdf = nullptr,
Float *uRemapped = nullptr) const {
// Find surrounding CDF segments and _offset_
int offset = FindInterval(cdf.size(),
int offset = FindInterval((int)cdf.size(),
[&](int index) { return cdf[index] <= u; });
if (pdf) *pdf = (funcInt > 0) ? func[offset] / (funcInt * Count()) : 0;
if (uRemapped)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment