removed many win64 compilation warnings
parent
d422d7df3d
commit
b203e2079b
|
@ -38,12 +38,12 @@ public:
|
|||
/// Return value of \ref BrentSolver::solve()
|
||||
struct Result {
|
||||
bool success;
|
||||
int iterations;
|
||||
size_t iterations;
|
||||
Float x;
|
||||
Float y;
|
||||
|
||||
/// Create a new result instance
|
||||
inline Result(bool success, int iterations, Float x, Float y)
|
||||
inline Result(bool success, size_t iterations, Float x, Float y)
|
||||
: success(success), iterations(iterations), x(x), y(y) { }
|
||||
|
||||
/// Return a string representation of the result
|
||||
|
|
|
@ -130,6 +130,9 @@ public:
|
|||
/// Return an integer on the [0, n)-interval
|
||||
uint32_t nextUInt(uint32_t n);
|
||||
|
||||
/// Return an integer on the [0, n)-interval
|
||||
size_t nextSize(size_t n);
|
||||
|
||||
/// Return a floating point value on the [0, 1) interval
|
||||
Float nextFloat();
|
||||
|
||||
|
@ -141,7 +144,7 @@ public:
|
|||
*/
|
||||
template <typename Iterator> void shuffle(Iterator it1, Iterator it2) {
|
||||
for (Iterator it = it2 - 1; it > it1; --it)
|
||||
std::iter_swap(it, it1 + nextUInt((uint32_t) (it-it1)));
|
||||
std::iter_swap(it, it1 + nextSize((size_t) (it-it1)));
|
||||
}
|
||||
|
||||
/// Serialize a random generator to a binary data stream
|
||||
|
|
|
@ -277,7 +277,7 @@ extern MTS_EXPORT_CORE bool solveQuadratic(Float a, Float b,
|
|||
* in Computer Graphics Proceedings, Annual Conference Series,
|
||||
* SIGGRAPH 97, pp. 49-56.
|
||||
*/
|
||||
extern MTS_EXPORT_CORE Float radicalInverse(int b, int i);
|
||||
extern MTS_EXPORT_CORE Float radicalInverse(int b, size_t i);
|
||||
|
||||
/**
|
||||
* Incrementally calculate the radical inverse function
|
||||
|
@ -386,7 +386,7 @@ extern MTS_EXPORT_CORE void stratifiedSample2D(Random *random, Point2 *dest,
|
|||
int countX, int countY, bool jitter);
|
||||
|
||||
/// Generate latin hypercube samples
|
||||
extern MTS_EXPORT_CORE void latinHypercube(Random *random, Float *dest, int nSamples, int nDim);
|
||||
extern MTS_EXPORT_CORE void latinHypercube(Random *random, Float *dest, size_t nSamples, size_t nDim);
|
||||
|
||||
/// Convert spherical coordinates to a direction
|
||||
extern MTS_EXPORT_CORE Vector sphericalDirection(Float theta, Float phi);
|
||||
|
|
|
@ -29,7 +29,7 @@ MTS_NAMESPACE_BEGIN
|
|||
class Composite : public BSDF {
|
||||
public:
|
||||
Composite(const Properties &props)
|
||||
: BSDF(props), m_bsdfCount(0), m_bsdfWeight(NULL) {
|
||||
: BSDF(props), m_bsdfWeight(NULL) {
|
||||
/* Parse the weight parameter */
|
||||
std::vector<std::string> weights =
|
||||
tokenize(props.getString("weights", ""), " ,;");
|
||||
|
@ -54,11 +54,11 @@ public:
|
|||
}
|
||||
|
||||
Composite(Stream *stream, InstanceManager *manager)
|
||||
: BSDF(stream, manager), m_bsdfCount(0), m_bsdfWeight(NULL) {
|
||||
m_bsdfCount = stream->readInt();
|
||||
: BSDF(stream, manager), m_bsdfWeight(NULL) {
|
||||
m_bsdfCount = stream->readSize();
|
||||
m_bsdfWeight = new Float[m_bsdfCount];
|
||||
m_bsdfOffset = new int[m_bsdfCount];
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
m_bsdfWeight[i] = stream->readFloat();
|
||||
BSDF *bsdf = static_cast<BSDF *>(manager->getInstance(stream));
|
||||
bsdf->incRef();
|
||||
|
@ -81,8 +81,8 @@ public:
|
|||
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||
BSDF::serialize(stream, manager);
|
||||
|
||||
stream->writeInt(m_bsdfCount);
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
stream->writeSize(m_bsdfCount);
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
stream->writeFloat(m_bsdfWeight[i]);
|
||||
manager->serialize(stream, m_bsdfs[i]);
|
||||
}
|
||||
|
@ -95,18 +95,18 @@ public:
|
|||
m_usesRayDifferentials = false;
|
||||
m_componentCount = 0;
|
||||
|
||||
if ((int) m_bsdfs.size() != m_bsdfCount)
|
||||
Log(EError, "BSDF count mismatch: %i bsdfs, but specified %i weights",
|
||||
(int) m_bsdfs.size(), m_bsdfCount);
|
||||
if (m_bsdfs.size() != m_bsdfCount)
|
||||
Log(EError, "BSDF count mismatch: " SIZE_T_FMT " bsdfs, but specified " SIZE_T_FMT " weights",
|
||||
m_bsdfs.size(), m_bsdfCount);
|
||||
|
||||
int offset = 0;
|
||||
for (int i=0; i<m_bsdfCount; ++i)
|
||||
for (size_t i=0; i<m_bsdfCount; ++i)
|
||||
m_componentCount = m_bsdfs[i]->getComponentCount();
|
||||
|
||||
m_pdf = DiscretePDF(m_bsdfs.size());
|
||||
|
||||
m_type = new unsigned int[m_componentCount];
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
BSDF *bsdf = m_bsdfs[i];
|
||||
m_bsdfOffset[i] = offset;
|
||||
for (int j=0; j<bsdf->getComponentCount(); ++j) {
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
Spectrum getDiffuseReflectance(const Intersection &its) const {
|
||||
Spectrum result(0.0f);
|
||||
for (int i=0; i<m_bsdfCount; ++i)
|
||||
for (size_t i=0; i<m_bsdfCount; ++i)
|
||||
result+= m_bsdfs[i]->getDiffuseReflectance(its) * m_bsdfWeight[i];
|
||||
return result;
|
||||
}
|
||||
|
@ -132,11 +132,11 @@ public:
|
|||
Spectrum result(0.0f);
|
||||
|
||||
if (bRec.component == -1) {
|
||||
for (int i=0; i<m_bsdfCount; ++i)
|
||||
for (size_t i=0; i<m_bsdfCount; ++i)
|
||||
result += m_bsdfs[i]->f(bRec) * m_bsdfWeight[i];
|
||||
} else {
|
||||
/* Pick out an individual component */
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
int component = bRec.component - m_bsdfOffset[i];
|
||||
if (component < 0 || component >= m_bsdfs[i]->getComponentCount())
|
||||
continue;
|
||||
|
@ -154,11 +154,11 @@ public:
|
|||
Spectrum result(0.0f);
|
||||
|
||||
if (bRec.component == -1) {
|
||||
for (int i=0; i<m_bsdfCount; ++i)
|
||||
for (size_t i=0; i<m_bsdfCount; ++i)
|
||||
result += m_bsdfs[i]->fDelta(bRec) * m_bsdfWeight[i];
|
||||
} else {
|
||||
/* Pick out an individual component */
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
int component = bRec.component - m_bsdfOffset[i];
|
||||
if (component < 0 || component >= m_bsdfs[i]->getComponentCount())
|
||||
continue;
|
||||
|
@ -176,11 +176,11 @@ public:
|
|||
Float result = 0.0f;
|
||||
|
||||
if (bRec.component == -1) {
|
||||
for (int i=0; i<m_bsdfCount; ++i)
|
||||
for (size_t i=0; i<m_bsdfCount; ++i)
|
||||
result += m_bsdfs[i]->pdf(bRec) * m_pdf[i];
|
||||
} else {
|
||||
/* Pick out an individual component */
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
int component = bRec.component - m_bsdfOffset[i];
|
||||
if (component < 0 || component >= m_bsdfs[i]->getComponentCount())
|
||||
continue;
|
||||
|
@ -198,11 +198,11 @@ public:
|
|||
Float result = 0.0f;
|
||||
|
||||
if (bRec.component == -1) {
|
||||
for (int i=0; i<m_bsdfCount; ++i)
|
||||
for (size_t i=0; i<m_bsdfCount; ++i)
|
||||
result += m_bsdfs[i]->pdfDelta(bRec) * m_pdf[i];
|
||||
} else {
|
||||
/* Pick out an individual component */
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
int component = bRec.component - m_bsdfOffset[i];
|
||||
if (component < 0 || component >= m_bsdfs[i]->getComponentCount())
|
||||
continue;
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
return result * m_bsdfWeight[entry];
|
||||
} else {
|
||||
/* Pick out an individual component */
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
int component = bRec.component - m_bsdfOffset[i];
|
||||
if (component < 0 || component >= m_bsdfs[i]->getComponentCount())
|
||||
continue;
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
return result * m_bsdfWeight[entry];
|
||||
} else {
|
||||
/* Pick out an individual component */
|
||||
for (int i=0; i<m_bsdfCount; ++i) {
|
||||
for (size_t i=0; i<m_bsdfCount; ++i) {
|
||||
int component = bRec.component - m_bsdfOffset[i];
|
||||
if (component < 0 || component >= m_bsdfs[i]->getComponentCount())
|
||||
continue;
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
|
||||
MTS_DECLARE_CLASS()
|
||||
private:
|
||||
int m_bsdfCount;
|
||||
size_t m_bsdfCount;
|
||||
Float *m_bsdfWeight;
|
||||
int *m_bsdfOffset;
|
||||
std::vector<BSDF *> m_bsdfs;
|
||||
|
|
|
@ -175,7 +175,7 @@ VertexData *fetchVertexData(Transform transform,
|
|||
semantic = vertInputs[vertInputIndex]->getSemantic();
|
||||
|
||||
if (vertInputIndex > 0) {
|
||||
offset = result->data.size();
|
||||
offset = (int) result->data.size();
|
||||
result->data.push_back(NULL);
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ void writeGeometry(ColladaContext &ctx, const std::string &prefixName, std::stri
|
|||
stream->close();
|
||||
filename = "meshes/" + filename;
|
||||
} else {
|
||||
ctx.cvt->m_geometryDict.push_back(ctx.cvt->m_geometryFile->getPos());
|
||||
ctx.cvt->m_geometryDict.push_back((uint32_t) ctx.cvt->m_geometryFile->getPos());
|
||||
mesh->serialize(ctx.cvt->m_geometryFile);
|
||||
filename = ctx.cvt->m_geometryFileName.filename();
|
||||
}
|
||||
|
|
|
@ -58,10 +58,10 @@ protected:
|
|||
AABB buildHierarchy(size_t index);
|
||||
|
||||
/// Heap convenience routines
|
||||
inline size_t leftChild(size_t index) const { return 2*index; }
|
||||
inline size_t rightChild(size_t index) const { return 2*index + 1; }
|
||||
inline bool isInnerNode(size_t index) const { return index <= m_lastInnerNode; }
|
||||
inline bool hasRightChild(size_t index) const { return index <= m_lastRChildNode; }
|
||||
inline uint32_t leftChild(uint32_t index) const { return 2*index; }
|
||||
inline uint32_t rightChild(uint32_t index) const { return 2*index + 1; }
|
||||
inline bool isInnerNode(uint32_t index) const { return index <= m_lastInnerNode; }
|
||||
inline bool hasRightChild(uint32_t index) const { return index <= m_lastRChildNode; }
|
||||
private:
|
||||
struct BRENode {
|
||||
AABB aabb;
|
||||
|
|
|
@ -347,7 +347,8 @@ private:
|
|||
ref<Mutex> m_mutex;
|
||||
Float m_initialRadius, m_alpha;
|
||||
int m_photonCount, m_granularity;
|
||||
int m_maxDepth, m_rrDepth, m_totalEmitted;
|
||||
int m_maxDepth, m_rrDepth;
|
||||
size_t m_totalEmitted;
|
||||
int m_blockSize;
|
||||
bool m_running;
|
||||
};
|
||||
|
|
|
@ -189,6 +189,24 @@ uint32_t Random::nextUInt(uint32_t n) {
|
|||
return result;
|
||||
}
|
||||
|
||||
size_t Random::nextSize(size_t n) {
|
||||
/* Determine a bit mask */
|
||||
size_t result, bitmask = n;
|
||||
bitmask |= bitmask >> 1;
|
||||
bitmask |= bitmask >> 2;
|
||||
bitmask |= bitmask >> 4;
|
||||
bitmask |= bitmask >> 8;
|
||||
bitmask |= bitmask >> 16;
|
||||
if (sizeof(size_t) == 8)
|
||||
bitmask |= bitmask >> 32;
|
||||
|
||||
/* Generate numbers until one in [0, n) is found */
|
||||
while ((result = (size_t) (nextULong() & bitmask)) >= n)
|
||||
;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(DOUBLE_PRECISION)
|
||||
Float Random::nextFloat() {
|
||||
return (Float) ((nextULong() >> 11) * (1.0/9007199254740992.0));
|
||||
|
|
|
@ -303,7 +303,7 @@ void Thread::initializeOpenMP(size_t threadCount) {
|
|||
ref<Logger> logger = Thread::getThread()->getLogger();
|
||||
ref<FileResolver> fResolver = Thread::getThread()->getFileResolver();
|
||||
|
||||
omp_set_num_threads(threadCount);
|
||||
omp_set_num_threads((int) threadCount);
|
||||
|
||||
#pragma omp parallel
|
||||
{
|
||||
|
|
|
@ -526,14 +526,14 @@ void stratifiedSample2D(Random *random, Point2 *dest, int countX, int countY, bo
|
|||
}
|
||||
}
|
||||
|
||||
void latinHypercube(Random *random, Float *dest, int nSamples, int nDim) {
|
||||
void latinHypercube(Random *random, Float *dest, size_t nSamples, size_t nDim) {
|
||||
Float delta = 1 / (Float) nSamples;
|
||||
for (int i = 0; i < nSamples; ++i)
|
||||
for (int j = 0; j < nDim; ++j)
|
||||
for (size_t i = 0; i < nSamples; ++i)
|
||||
for (size_t j = 0; j < nDim; ++j)
|
||||
dest[nDim * i + j] = (i + random->nextFloat()) * delta;
|
||||
for (int i = 0; i < nDim; ++i) {
|
||||
for (int j = 0; j < nSamples; ++j) {
|
||||
int other = random->nextUInt(nSamples);
|
||||
for (size_t i = 0; i < nDim; ++i) {
|
||||
for (size_t j = 0; j < nSamples; ++j) {
|
||||
size_t other = random->nextSize(nSamples);
|
||||
std::swap(dest[nDim * j + i], dest[nDim * other + i]);
|
||||
}
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ Float fresnel(Float cosTheta1, Float etaExt, Float etaInt) {
|
|||
etaInt, etaExt);
|
||||
}
|
||||
|
||||
Float radicalInverse(int b, int i) {
|
||||
Float radicalInverse(int b, size_t i) {
|
||||
Float invB = (Float) 1 / (Float) b;
|
||||
Float x = 0.0f, f = invB;
|
||||
|
||||
|
|
|
@ -70,19 +70,19 @@ Wavelet2D::Wavelet2D(const SparseWavelet2D *sw) {
|
|||
m_data[0] = sw->getScalingFunction();
|
||||
|
||||
/* Loop over the resolution hierarchy and extract the coefficients */
|
||||
size_t level = 0;
|
||||
size_t size = 1, offset = 1;
|
||||
uint8_t level = 0;
|
||||
uint16_t size = 1, offset = 1;
|
||||
while (size < m_size) {
|
||||
/* Loop over the different types of differentiation */
|
||||
for (int type=0; type<3; type++) {
|
||||
for (uint8_t type=0; type<3; type++) {
|
||||
size_t offsetX = 0, offsetY = 0;
|
||||
switch (type) {
|
||||
case 0: offsetX = offset; break;
|
||||
case 1: offsetY = offset; break;
|
||||
case 2: offsetX = offset; offsetY = offset; break;
|
||||
}
|
||||
for (size_t j=0; j<size; j++) {
|
||||
for (size_t i=0; i<size; i++) {
|
||||
for (uint16_t j=0; j<size; j++) {
|
||||
for (uint16_t i=0; i<size; i++) {
|
||||
size_t pos = (j+offsetY)*m_size + i + offsetX;
|
||||
Assert(pos < m_size*m_size);
|
||||
m_data[pos] = sw->get(SparseWavelet2D::Key::create(level, type, i, j));
|
||||
|
@ -100,8 +100,8 @@ SparseWavelet2D *Wavelet2D::toSparseWavelet() const {
|
|||
sparse->setScalingFunction(m_data[0]);
|
||||
|
||||
/* Loop over the resolution hierarchy and extract the coefficients */
|
||||
size_t level = 0;
|
||||
size_t size = 1, offset = 1;
|
||||
uint8_t level = 0;
|
||||
uint16_t size = 1, offset = 1;
|
||||
|
||||
while (size < m_size) {
|
||||
/* Loop over the different types of differentiation */
|
||||
|
@ -113,8 +113,8 @@ SparseWavelet2D *Wavelet2D::toSparseWavelet() const {
|
|||
case 2: offsetX = offset; offsetY = offset; break;
|
||||
}
|
||||
|
||||
for (size_t j=0; j<size; j++) {
|
||||
for (size_t i=0; i<size; i++) {
|
||||
for (uint16_t j=0; j<size; j++) {
|
||||
for (uint16_t i=0; i<size; i++) {
|
||||
size_t pos = (j+offsetY)*m_size + i + offsetX;
|
||||
Assert(pos < m_size*m_size);
|
||||
if (m_data[pos] == 0.0f)
|
||||
|
@ -390,9 +390,9 @@ void SparseWavelet2D::serialize(Stream *stream, InstanceManager *Manager) const
|
|||
Float SparseWavelet2D::lineIntegral(Point2 start, Point2 end) const {
|
||||
Vector2 d = end-start;
|
||||
Float accum = 0, maxt = d.length();
|
||||
int res = m_size;
|
||||
size_t res = m_size;
|
||||
Key key;
|
||||
|
||||
|
||||
d/= maxt;
|
||||
key.empty = 0;
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ void GLGeometry::refresh() {
|
|||
m_stride += 3;
|
||||
m_stride *= sizeof(GLfloat);
|
||||
|
||||
m_vertexSize = m_mesh->getVertexCount() * m_stride;
|
||||
m_indexSize = m_mesh->getTriangleCount() * sizeof(GLuint) * 3;
|
||||
m_vertexSize = (GLuint) (m_mesh->getVertexCount() * m_stride);
|
||||
m_indexSize = (GLuint) (m_mesh->getTriangleCount() * sizeof(GLuint) * 3);
|
||||
|
||||
Log(ETrace, "Uploading a GPU geometry object (\"%s\", " SIZE_T_FMT
|
||||
" vertices, " SIZE_T_FMT " triangles, %s)",
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
GatherPhotonWorker(Stream *stream, InstanceManager *manager)
|
||||
: ParticleTracer(stream, manager) {
|
||||
m_type = (GatherPhotonProcess::EGatherType) stream->readInt();
|
||||
m_granularity = stream->readUInt();
|
||||
m_granularity = stream->readSize();
|
||||
}
|
||||
|
||||
ref<WorkProcessor> clone() const {
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||
ParticleTracer::serialize(stream, manager);
|
||||
stream->writeInt(m_type);
|
||||
stream->writeUInt(m_granularity);
|
||||
stream->writeSize(m_granularity);
|
||||
}
|
||||
|
||||
ref<WorkResult> createWorkResult() const {
|
||||
|
|
|
@ -239,9 +239,9 @@ IrradianceCache::IrradianceCache(Stream *stream, InstanceManager *manager) :
|
|||
m_clampScreen = stream->readBool();
|
||||
m_clampNeighbor = stream->readBool();
|
||||
m_useGradients = stream->readBool();
|
||||
uint32_t recordCount = stream->readUInt();
|
||||
size_t recordCount = stream->readSize();
|
||||
m_records.reserve(recordCount);
|
||||
for (uint32_t i=0; i<recordCount; ++i) {
|
||||
for (size_t i=0; i<recordCount; ++i) {
|
||||
Record *sample = new Record(stream);
|
||||
Float validRadius = sample->R0 / (2*m_kappa);
|
||||
m_octree.insert(sample, AABB(
|
||||
|
@ -266,7 +266,7 @@ void IrradianceCache::serialize(Stream *stream, InstanceManager *manager) const
|
|||
stream->writeBool(m_clampScreen);
|
||||
stream->writeBool(m_clampNeighbor);
|
||||
stream->writeBool(m_useGradients);
|
||||
stream->writeUInt(m_records.size());
|
||||
stream->writeSize(m_records.size());
|
||||
for (uint32_t i=0; i<m_records.size(); ++i)
|
||||
m_records[i]->serialize(stream);
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ Sampler::Sampler(const Properties &props)
|
|||
Sampler::Sampler(Stream *stream, InstanceManager *manager)
|
||||
: ConfigurableObject(stream, manager) {
|
||||
m_sampleCount = stream->readSize();
|
||||
uint32_t n1DArrays = stream->readUInt();
|
||||
for (uint32_t i=0; i<n1DArrays; ++i)
|
||||
size_t n1DArrays = stream->readSize();
|
||||
for (size_t i=0; i<n1DArrays; ++i)
|
||||
request1DArray(stream->readUInt());
|
||||
uint32_t n2DArrays = stream->readUInt();
|
||||
for (uint32_t i=0; i<n2DArrays; ++i)
|
||||
size_t n2DArrays = stream->readSize();
|
||||
for (size_t i=0; i<n2DArrays; ++i)
|
||||
request2DArray(stream->readUInt());
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,10 @@ void Sampler::serialize(Stream *stream, InstanceManager *manager) const {
|
|||
ConfigurableObject::serialize(stream, manager);
|
||||
|
||||
stream->writeSize(m_sampleCount);
|
||||
stream->writeUInt(m_req1D.size());
|
||||
stream->writeSize(m_req1D.size());
|
||||
for (size_t i=0; i<m_req1D.size(); ++i)
|
||||
stream->writeUInt(m_req1D[i]);
|
||||
stream->writeUInt(m_req2D.size());
|
||||
stream->writeSize(m_req2D.size());
|
||||
for (size_t i=0; i<m_req2D.size(); ++i)
|
||||
stream->writeUInt(m_req2D[i]);
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@ Subsurface::Subsurface(Stream *stream, InstanceManager *manager) :
|
|||
m_sigmaA = Spectrum(stream);
|
||||
m_eta = stream->readFloat();
|
||||
m_densityMultiplier = stream->readFloat();
|
||||
unsigned int shapeCount = stream->readUInt();
|
||||
size_t shapeCount = stream->readSize();
|
||||
|
||||
for (unsigned int i=0; i<shapeCount; ++i) {
|
||||
for (size_t i=0; i<shapeCount; ++i) {
|
||||
Shape *shape = static_cast<Shape *>(manager->getInstance(stream));
|
||||
m_shapes.push_back(shape);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ void Subsurface::serialize(Stream *stream, InstanceManager *manager) const {
|
|||
m_sigmaA.serialize(stream);
|
||||
stream->writeFloat(m_eta);
|
||||
stream->writeFloat(m_densityMultiplier);
|
||||
stream->writeUInt(m_shapes.size());
|
||||
stream->writeSize(m_shapes.size());
|
||||
for (unsigned int i=0; i<m_shapes.size(); ++i)
|
||||
manager->serialize(stream, m_shapes[i]);
|
||||
}
|
||||
|
|
|
@ -335,10 +335,10 @@ struct vertex_key_order : public
|
|||
|
||||
/// Used in \ref TriMesh::rebuildTopology()
|
||||
struct TopoData {
|
||||
uint32_t idx; /// Triangle index
|
||||
size_t idx; /// Triangle index
|
||||
bool clustered; /// Has the tri-vert. pair been assigned to a cluster?
|
||||
inline TopoData() { }
|
||||
inline TopoData(uint32_t idx, bool clustered)
|
||||
inline TopoData(size_t idx, bool clustered)
|
||||
: idx(idx), clustered(clustered) { }
|
||||
};
|
||||
|
||||
|
|
|
@ -129,7 +129,8 @@ namespace mitsuba {
|
|||
};
|
||||
|
||||
struct PreviewQueueEntry {
|
||||
int id, vplSampleOffset;
|
||||
int id;
|
||||
size_t vplSampleOffset;
|
||||
GPUTexture *buffer;
|
||||
GPUSync *sync;
|
||||
|
||||
|
|
|
@ -1057,7 +1057,7 @@ void MainWindow::on_actionSettings_triggered() {
|
|||
|
||||
size_t workerCount = sched->getWorkerCount();
|
||||
for (size_t i=0; i<workerCount; ++i) {
|
||||
Worker *worker = sched->getWorker(i);
|
||||
Worker *worker = sched->getWorker((int) i);
|
||||
if (worker->getClass()->derivesFrom(MTS_CLASS(LocalWorker)))
|
||||
localWorkers.push_back(worker);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,8 @@ private:
|
|||
ref<WaitFlag> m_started;
|
||||
std::list<PreviewQueueEntry> m_readyQueue, m_recycleQueue;
|
||||
SceneContext *m_context;
|
||||
int m_vplSampleOffset, m_minVPLs, m_vplCount;
|
||||
size_t m_vplSampleOffset;
|
||||
int m_minVPLs, m_vplCount;
|
||||
int m_vplsPerSecond, m_raysPerSecond;
|
||||
int m_bufferCount, m_queueEntryIndex;
|
||||
std::deque<VPL> m_vpls;
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
}
|
||||
|
||||
inline void setLocalWorkerCount(size_t count) {
|
||||
ui->localWorkerBox->setValue(count);
|
||||
ui->localWorkerBox->setValue((int) count);
|
||||
}
|
||||
|
||||
inline int getLocalWorkerCount() {
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
inline void generate1D(Float *samples, size_t sampleCount) {
|
||||
uint32_t scramble = m_random->nextULong() & 0xFFFFFFFF;
|
||||
for (size_t i = 0; i < sampleCount; ++i)
|
||||
samples[i] = vanDerCorput(i, scramble);
|
||||
samples[i] = vanDerCorput((uint32_t) i, scramble);
|
||||
m_random->shuffle(samples, samples + sampleCount);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
} scramble;
|
||||
scramble.qword = m_random->nextULong();
|
||||
for (size_t i = 0; i < sampleCount; ++i)
|
||||
sample02(i, scramble.dword, samples[i]);
|
||||
sample02((uint32_t) i, scramble.dword, samples[i]);
|
||||
m_random->shuffle(samples, samples + sampleCount);
|
||||
}
|
||||
|
||||
|
|
|
@ -390,8 +390,8 @@ public:
|
|||
for (size_t phi=0; phi<phiSteps; ++phi) {
|
||||
Float sinPhi = std::sin(phi * dPhi);
|
||||
Float cosPhi = std::cos(phi * dPhi);
|
||||
int idx0 = vertexIdx, idx1 = idx0+1;
|
||||
int idx2 = (vertexIdx+2) % (2*phiSteps), idx3 = idx2+1;
|
||||
uint32_t idx0 = (uint32_t) vertexIdx, idx1 = idx0+1;
|
||||
uint32_t idx2 = (vertexIdx+2) % (2*phiSteps), idx3 = idx2+1;
|
||||
normals[vertexIdx] = m_objectToWorld(Normal(cosPhi, sinPhi, 0));
|
||||
vertices[vertexIdx++] = m_objectToWorld(Point(cosPhi*m_radius, sinPhi*m_radius, 0));
|
||||
normals[vertexIdx] = m_objectToWorld(Normal(cosPhi, sinPhi, 0));
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
if (m_vertexStartsFiber[i])
|
||||
m_hairCount++;
|
||||
if (!m_vertexStartsFiber[i+1])
|
||||
m_segIndex.push_back(i);
|
||||
m_segIndex.push_back((index_type) i);
|
||||
}
|
||||
m_segmentCount = m_segIndex.size();
|
||||
|
||||
|
@ -401,7 +401,7 @@ public:
|
|||
#endif
|
||||
|
||||
/// Return the total number of segments
|
||||
inline int getPrimitiveCount() const {
|
||||
inline size_t getPrimitiveCount() const {
|
||||
return m_segIndex.size();
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ public:
|
|||
}
|
||||
|
||||
size_t hairIdx = 0;
|
||||
for (size_t iv=0; iv<hairVertices.size()-1; iv++) {
|
||||
for (index_type iv=0; iv<(index_type) hairVertices.size()-1; iv++) {
|
||||
if (!vertexStartsFiber[iv+1]) {
|
||||
for (size_t phi=0; phi<phiSteps; ++phi) {
|
||||
Vector tangent = m_kdtree->tangent(iv);
|
||||
|
@ -682,8 +682,8 @@ public:
|
|||
normals[vertexIdx] = normal;
|
||||
vertices[vertexIdx++] = m_kdtree->secondVertex(iv) + radius*dir - tangent*t2;
|
||||
|
||||
int idx0 = 2*(phi + hairIdx*phiSteps), idx1 = idx0+1;
|
||||
int idx2 = (2*phi+2) % (2*phiSteps) + 2*hairIdx*phiSteps, idx3 = idx2+1;
|
||||
uint32_t idx0 = 2*(phi + hairIdx*phiSteps), idx1 = idx0+1;
|
||||
uint32_t idx2 = (2*phi+2) % (2*phiSteps) + 2*hairIdx*phiSteps, idx3 = idx2+1;
|
||||
triangles[triangleIdx].idx[0] = idx0;
|
||||
triangles[triangleIdx].idx[1] = idx2;
|
||||
triangles[triangleIdx].idx[2] = idx1;
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
return false;
|
||||
if (line == "")
|
||||
return true;
|
||||
int lastCharacter = line.size()-1;
|
||||
int lastCharacter = (int) line.size() - 1;
|
||||
while (lastCharacter >= 0 &&
|
||||
(line[lastCharacter] == '\r' ||
|
||||
line[lastCharacter] == '\n' ||
|
||||
|
|
|
@ -247,16 +247,16 @@ public:
|
|||
|
||||
ref<TriMesh> createTriMesh() {
|
||||
/// Choice of discretization
|
||||
const size_t thetaSteps = 20;
|
||||
const size_t phiSteps = thetaSteps * 2;
|
||||
const uint32_t thetaSteps = 20;
|
||||
const uint32_t phiSteps = thetaSteps * 2;
|
||||
const Float dTheta = M_PI / (thetaSteps-1);
|
||||
const Float dPhi = (2*M_PI) / phiSteps;
|
||||
size_t topIdx = (thetaSteps-2) * phiSteps, botIdx = topIdx+1;
|
||||
uint32_t topIdx = (thetaSteps-2) * phiSteps, botIdx = topIdx+1;
|
||||
|
||||
/// Precompute cosine and sine tables
|
||||
Float *cosPhi = new Float[phiSteps];
|
||||
Float *sinPhi = new Float[phiSteps];
|
||||
for (size_t i=0; i<phiSteps; ++i) {
|
||||
for (uint32_t i=0; i<phiSteps; ++i) {
|
||||
sinPhi[i] = std::sin(i*dPhi);
|
||||
cosPhi[i] = std::cos(i*dPhi);
|
||||
}
|
||||
|
@ -269,12 +269,12 @@ public:
|
|||
Point *vertices = mesh->getVertexPositions();
|
||||
Normal *normals = mesh->getVertexNormals();
|
||||
Triangle *triangles = mesh->getTriangles();
|
||||
size_t vertexIdx = 0;
|
||||
for (size_t theta=1; theta<thetaSteps-1; ++theta) {
|
||||
uint32_t vertexIdx = 0;
|
||||
for (uint32_t theta=1; theta<thetaSteps-1; ++theta) {
|
||||
Float sinTheta = std::sin(theta * dTheta);
|
||||
Float cosTheta = std::cos(theta * dTheta);
|
||||
|
||||
for (size_t phi=0; phi<phiSteps; ++phi) {
|
||||
for (uint32_t phi=0; phi<phiSteps; ++phi) {
|
||||
Vector v(
|
||||
sinTheta * cosPhi[phi],
|
||||
sinTheta * sinPhi[phi],
|
||||
|
@ -290,11 +290,11 @@ public:
|
|||
normals[vertexIdx++] = m_objectToWorld(Normal(0, 0, -1));
|
||||
Assert(vertexIdx == botIdx+1);
|
||||
|
||||
size_t triangleIdx = 0;
|
||||
for (size_t theta=1; theta<thetaSteps; ++theta) {
|
||||
for (size_t phi=0; phi<phiSteps; ++phi) {
|
||||
size_t nextPhi = (phi + 1) % phiSteps;
|
||||
size_t idx0, idx1, idx2, idx3;
|
||||
uint32_t triangleIdx = 0;
|
||||
for (uint32_t theta=1; theta<thetaSteps; ++theta) {
|
||||
for (uint32_t phi=0; phi<phiSteps; ++phi) {
|
||||
uint32_t nextPhi = (phi + 1) % phiSteps;
|
||||
uint32_t idx0, idx1, idx2, idx3;
|
||||
if (theta == 1) {
|
||||
idx0 = idx1 = topIdx;
|
||||
} else {
|
||||
|
|
|
@ -284,7 +284,7 @@ public:
|
|||
int index = -1;
|
||||
for (size_t i=0; i<ssIntegrators.size(); ++i) {
|
||||
if (ssIntegrators[i] == this) {
|
||||
index = i;
|
||||
index = (int) i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
nTraversals += kdtree.nnSearch(p, k, results);
|
||||
resultsBF.clear();
|
||||
for (size_t j=0; j<nPoints; ++j)
|
||||
resultsBF.push_back(KDTree2::SearchResult((kdtree[j].getPosition()-p).lengthSquared(), j));
|
||||
resultsBF.push_back(KDTree2::SearchResult((kdtree[j].getPosition()-p).lengthSquared(), (uint32_t) j));
|
||||
std::sort(results.begin(), results.end(), KDTree2::SearchResultComparator());
|
||||
std::sort(resultsBF.begin(), resultsBF.end(), KDTree2::SearchResultComparator());
|
||||
for (int j=0; j<k; ++j)
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
: Texture2D(stream, manager) {
|
||||
m_filename = stream->readString();
|
||||
Log(EInfo, "Unserializing texture \"%s\"", m_filename.leaf().c_str());
|
||||
int size = stream->readInt();
|
||||
size_t size = stream->readSize();
|
||||
ref<MemoryStream> mStream = new MemoryStream(size);
|
||||
stream->copyTo(mStream, size);
|
||||
mStream->setPos(0);
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
Texture2D::serialize(stream, manager);
|
||||
stream->writeString(m_filename.file_string());
|
||||
ref<Stream> is = new FileStream(m_filename, FileStream::EReadOnly);
|
||||
stream->writeInt(is->getSize());
|
||||
stream->writeSize(is->getSize());
|
||||
is->copyTo(stream);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue