merge
commit
b866180094
include/mitsuba
src
bsdfs
converter
films
integrators
path
luminaires
phase
samplers
subsurface
textures
volume
|
@ -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);
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
inline void setSize(const Point3i &size) { m_size = size; }
|
||||
|
||||
/// Get the maximal anisotropy
|
||||
inline float getMaxAnisotropy() const { return m_maxAnisotropy; }
|
||||
inline Float getMaxAnisotropy() const { return m_maxAnisotropy; }
|
||||
|
||||
/** \brief Set the maximal anisotropy.
|
||||
*
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
* texture filtering. A value of 0 (default) will
|
||||
* use the global max. anisotropy value
|
||||
*/
|
||||
inline void setMaxAnisotropy(float maxAnisotropy) { m_maxAnisotropy = maxAnisotropy; }
|
||||
inline void setMaxAnisotropy(Float maxAnisotropy) { m_maxAnisotropy = maxAnisotropy; }
|
||||
|
||||
/// Return whether mipmapping is enabled
|
||||
inline bool isMipMapped() const { return m_mipmapped; }
|
||||
|
@ -363,7 +363,7 @@ protected:
|
|||
EDepthMode m_depthMode;
|
||||
bool m_mipmapped;
|
||||
mutable PrimitiveThreadLocal<std::set<int> > m_textureUnits;
|
||||
float m_maxAnisotropy;
|
||||
Float m_maxAnisotropy;
|
||||
int m_samples;
|
||||
std::vector<Bitmap *> m_bitmaps;
|
||||
Point3i m_size;
|
||||
|
|
|
@ -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", ""), " ,;");
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
Float totalWeight = 0;
|
||||
char *end_ptr = NULL;
|
||||
for (size_t i=0; i<weights.size(); ++i) {
|
||||
Float weight = strtod(weights[i].c_str(), &end_ptr);
|
||||
Float weight = (Float) strtod(weights[i].c_str(), &end_ptr);
|
||||
if (*end_ptr != '\0')
|
||||
SLog(EError, "Could not parse the BRDF weights!");
|
||||
if (weight < 0)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -1428,19 +1428,19 @@ void loadAnimation(ColladaContext &ctx, domAnimation &anim) {
|
|||
domListOfFloats &floatArray = source->getFloat_array()->getValue();
|
||||
SAssert(stride == 1);
|
||||
for (size_t i=0; i<size; ++i)
|
||||
track->setTime(i, floatArray[i]);
|
||||
track->setTime(i, (Float) floatArray[i]);
|
||||
} else if (semantic == "OUTPUT") {
|
||||
domListOfFloats &floatArray = source->getFloat_array()->getValue();
|
||||
if (trackType == VectorTrack::ETranslationXYZ || trackType == VectorTrack::EScaleXYZ) {
|
||||
SAssert(stride == 3);
|
||||
for (size_t i=0; i<size; ++i)
|
||||
((VectorTrack *) track)->setValue(i,
|
||||
Vector(floatArray[i*3+0], floatArray[i*3+1],
|
||||
floatArray[i*3+2]));
|
||||
Vector((Float) floatArray[i*3+0], (Float) floatArray[i*3+1],
|
||||
(Float) floatArray[i*3+2]));
|
||||
} else {
|
||||
SAssert(stride == 1);
|
||||
for (size_t i=0; i<size; ++i)
|
||||
((FloatTrack *) track)->setValue(i, floatArray[i]);
|
||||
((FloatTrack *) track)->setValue(i, (Float) floatArray[i]);
|
||||
}
|
||||
} else if (semantic == "INTERPOLATION") {
|
||||
/// Ignored for now
|
||||
|
@ -1537,8 +1537,8 @@ GLvoid __stdcall tessCombine(GLdouble coords[3], void *vertex_data[4],
|
|||
|
||||
// this will be very slow -- let's hope that it happens rarely
|
||||
Vec4 *oldVec = tess_vdata->data[offset];
|
||||
Vec4 *newVec = new Vec4[size+1];
|
||||
memcpy(newVec, oldVec, size * sizeof(Vec4));
|
||||
Vec4 *newVec = new Vec4[(size_t) size + 1];
|
||||
memcpy(newVec, oldVec, (size_t) size * sizeof(Vec4));
|
||||
|
||||
newVec[size] = Vec4(0.0f);
|
||||
for (int j=0; j<4; ++j) {
|
||||
|
|
|
@ -193,7 +193,7 @@ void GeometryConverter::convertOBJ(const fs::path &inputFile,
|
|||
stream->close();
|
||||
os << "\t\t<string name=\"filename\" value=\"meshes/" << filename.c_str() << "\"/>" << endl;
|
||||
} else {
|
||||
m_geometryDict.push_back(m_geometryFile->getPos());
|
||||
m_geometryDict.push_back((uint32_t) m_geometryFile->getPos());
|
||||
SLog(EInfo, "Saving mesh \"%s\"", mesh->getName().c_str());
|
||||
mesh->serialize(m_geometryFile);
|
||||
os << "\t\t<string name=\"filename\" value=\"" << m_geometryFileName.filename() << "\"/>" << endl;
|
||||
|
|
|
@ -261,7 +261,7 @@ public:
|
|||
Float Lp = Y * reinhardKey;
|
||||
Y = Lp * (1.0f + Lp*invWpSqr) / (1.0f + Lp);
|
||||
X = x * (Y/y);
|
||||
Z = (Y/y) * (1.0 - x - y);
|
||||
Z = (Y/y) * (1.0f - x - y);
|
||||
spec.fromXYZ(X, Y, Z);
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ public:
|
|||
Float Lp = Y * reinhardKey;
|
||||
Y = Lp * (1.0f + Lp*invWpSqr) / (1.0f + Lp);
|
||||
X = x * (Y/y);
|
||||
Z = (Y/y) * (1.0 - x - y);
|
||||
Z = (Y/y) * (1.0f - x - y);
|
||||
spec.fromXYZ(X, Y, Z);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
const Film *film = camera->getFilm();
|
||||
size_t sampleCount = scene->getSampler()->getSampleCount();
|
||||
size_t nCores = scheduler->getCoreCount();
|
||||
Log(EInfo, "Starting render job (%ix%i, %lld samples, " SIZE_T_FMT
|
||||
Log(EInfo, "Starting render job (%ix%i, " SIZE_T_FMT " samples, " SIZE_T_FMT
|
||||
" %s, " SSE_STR ") ..", film->getCropSize().x, film->getCropSize().y,
|
||||
sampleCount, nCores, nCores == 1 ? "core" : "cores");
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
BeamRadianceEstimator::BeamRadianceEstimator(const PhotonMap *pmap, size_t lookupSize) {
|
||||
size_t reducedLookupSize = (size_t) std::sqrt((Float) lookupSize);
|
||||
uint32_t reducedLookupSize = (uint32_t) std::sqrt((Float) lookupSize);
|
||||
Float sizeFactor = (Float) lookupSize/ (Float) reducedLookupSize;
|
||||
|
||||
m_photonCount = pmap->getPhotonCount();
|
||||
m_photonCount = (uint32_t) pmap->getPhotonCount();
|
||||
m_scaleFactor = pmap->getScaleFactor();
|
||||
m_lastInnerNode = m_photonCount/2;
|
||||
m_lastRChildNode = (m_photonCount-1)/2;
|
||||
|
@ -73,7 +73,7 @@ BeamRadianceEstimator::BeamRadianceEstimator(const PhotonMap *pmap, size_t looku
|
|||
}
|
||||
|
||||
BeamRadianceEstimator::BeamRadianceEstimator(Stream *stream, InstanceManager *manager) {
|
||||
m_photonCount = stream->readSize();
|
||||
m_photonCount = stream->readUInt();
|
||||
m_scaleFactor = stream->readFloat();
|
||||
m_lastInnerNode = m_photonCount/2;
|
||||
m_lastRChildNode = (m_photonCount-1)/2;
|
||||
|
@ -88,7 +88,7 @@ BeamRadianceEstimator::BeamRadianceEstimator(Stream *stream, InstanceManager *ma
|
|||
}
|
||||
|
||||
void BeamRadianceEstimator::serialize(Stream *stream, InstanceManager *manager) const {
|
||||
stream->writeSize(m_photonCount);
|
||||
stream->writeUInt(m_photonCount);
|
||||
stream->writeFloat(m_scaleFactor);
|
||||
for (size_t i=1; i<=m_photonCount; ++i) {
|
||||
BRENode &node = m_nodes[i];
|
||||
|
@ -98,7 +98,7 @@ void BeamRadianceEstimator::serialize(Stream *stream, InstanceManager *manager)
|
|||
}
|
||||
}
|
||||
|
||||
AABB BeamRadianceEstimator::buildHierarchy(size_t index) {
|
||||
AABB BeamRadianceEstimator::buildHierarchy(uint32_t index) {
|
||||
BRENode &node = m_nodes[index];
|
||||
|
||||
if (isInnerNode(index)) {
|
||||
|
@ -127,7 +127,7 @@ Spectrum BeamRadianceEstimator::query(const Ray &r, const Medium *medium) const
|
|||
uint32_t *stack = (uint32_t *) alloca((m_depth+1) * sizeof(uint32_t));
|
||||
uint32_t index = 1, stackPos = 1;
|
||||
Spectrum result(0.0f);
|
||||
size_t nNodes = 0;
|
||||
uint32_t nNodes = 0;
|
||||
|
||||
const Spectrum &sigmaT = medium->getSigmaT();
|
||||
const PhaseFunction *phase = medium->getPhaseFunction();
|
||||
|
|
|
@ -55,13 +55,13 @@ protected:
|
|||
virtual ~BeamRadianceEstimator();
|
||||
|
||||
/// Fit a hierarchy of bounding boxes to the stored photons
|
||||
AABB buildHierarchy(size_t index);
|
||||
AABB buildHierarchy(uint32_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;
|
||||
|
@ -70,9 +70,9 @@ private:
|
|||
};
|
||||
|
||||
BRENode *m_nodes;
|
||||
size_t m_photonCount;
|
||||
size_t m_lastInnerNode;
|
||||
size_t m_lastRChildNode;
|
||||
uint32_t m_photonCount;
|
||||
uint32_t m_lastInnerNode;
|
||||
uint32_t m_lastRChildNode;
|
||||
int m_depth;
|
||||
Float m_scaleFactor;
|
||||
};
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
Sampler *cameraSampler = (Sampler *) sched->getResource(samplerResID, 0);
|
||||
|
||||
size_t sampleCount = cameraSampler->getSampleCount();
|
||||
Log(EInfo, "Starting render job (%ix%i, %lld %s, " SIZE_T_FMT
|
||||
Log(EInfo, "Starting render job (%ix%i, " SIZE_T_FMT " %s, " SIZE_T_FMT
|
||||
" %s, " SSE_STR ") ..", film->getCropSize().x, film->getCropSize().y,
|
||||
sampleCount, sampleCount == 1 ? "sample" : "samples", nCores,
|
||||
nCores == 1 ? "core" : "cores");
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
camera->generateRayDifferential(sample,
|
||||
lensSample, timeSample, eyeRay);
|
||||
size_t offset = gatherPoints.size();
|
||||
int count = createGatherPoints(scene, eyeRay, sample,
|
||||
Float count = (Float) createGatherPoints(scene, eyeRay, sample,
|
||||
cameraSampler, Spectrum(1.0f),
|
||||
gatherPoints, 1);
|
||||
if (count > 1) { // necessary because of filter weight computation
|
||||
|
@ -311,8 +311,9 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
Float M = photonMap->estimateRadianceRaw(
|
||||
g.its, g.radius, flux, m_maxDepth == -1 ? INT_MAX : (m_maxDepth-g.depth)), N = g.N;
|
||||
Float M = (Float) photonMap->estimateRadianceRaw(
|
||||
g.its, g.radius, flux, m_maxDepth == -1 ? INT_MAX : (m_maxDepth-g.depth));
|
||||
Float N = g.N;
|
||||
|
||||
if (N+M == 0) {
|
||||
g.flux = contrib = Spectrum(0.0f);
|
||||
|
@ -346,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;
|
||||
};
|
||||
|
|
|
@ -293,7 +293,7 @@ public:
|
|||
Spectrum flux, contrib;
|
||||
|
||||
if (gp.depth != -1) {
|
||||
M = photonMap->estimateRadianceRaw(
|
||||
M = (Float) photonMap->estimateRadianceRaw(
|
||||
gp.its, gp.radius, flux, m_maxDepth-gp.depth);
|
||||
} else {
|
||||
M = 0;
|
||||
|
@ -305,7 +305,7 @@ public:
|
|||
} else {
|
||||
Float ratio = (N + m_alpha * M) / (N + M);
|
||||
gp.flux = (gp.flux + gp.weight * (flux +
|
||||
gp.emission * proc->getShotParticles() * M_PI * gp.radius*gp.radius)) * ratio;
|
||||
gp.emission * (Float) proc->getShotParticles() * M_PI * gp.radius*gp.radius)) * ratio;
|
||||
gp.radius = gp.radius * std::sqrt(ratio);
|
||||
gp.N = N + m_alpha * M;
|
||||
contrib = gp.flux / ((Float) m_totalEmitted * gp.radius*gp.radius * M_PI);
|
||||
|
@ -335,7 +335,8 @@ private:
|
|||
ref<Bitmap> m_bitmap;
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -137,7 +137,7 @@ size_t Properties::getSize(const std::string &name) const {
|
|||
if ((*it).second.v_long < 0)
|
||||
SLog(EError, "Size property \"%s\": expected a nonnegative value!");
|
||||
(*it).second.queried = true;
|
||||
return (*it).second.v_long;
|
||||
return (size_t) (*it).second.v_long;
|
||||
}
|
||||
|
||||
size_t Properties::getSize(const std::string &name, size_t defVal) const {
|
||||
|
@ -149,7 +149,7 @@ size_t Properties::getSize(const std::string &name, size_t defVal) const {
|
|||
if ((*it).second.v_long < 0)
|
||||
SLog(EError, "Size property \"%s\": expected a nonnegative value!");
|
||||
(*it).second.queried = true;
|
||||
return (*it).second.v_long;
|
||||
return (size_t) (*it).second.v_long;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -189,6 +189,27 @@ 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 defined(WIN64) || defined(__LINUX__) || defined(__OSX__)
|
||||
if (sizeof(size_t) > 4)
|
||||
bitmask |= bitmask >> 32;
|
||||
#endif
|
||||
|
||||
/* 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)
|
||||
|
@ -343,7 +343,7 @@ SparseWavelet2D::SparseWavelet2D(Stream *stream, InstanceManager *Manager) {
|
|||
m_data.set_empty_key(0xFFFFFFFFFFFFFFFFULL);
|
||||
#endif
|
||||
for (size_t i=0; i<coefficientCount; i++) {
|
||||
uint64_t key = stream->readSize();
|
||||
uint64_t key = stream->readULong();
|
||||
m_data[key] = stream->readSingle();
|
||||
}
|
||||
m_maxLevel = log2i(m_size)-1;
|
||||
|
@ -382,7 +382,7 @@ void SparseWavelet2D::serialize(Stream *stream, InstanceManager *Manager) const
|
|||
stream->writeSize(m_data.size());
|
||||
|
||||
for (CoefficientIterator it = m_data.begin(); it != m_data.end(); ++it) {
|
||||
stream->writeSize((*it).first);
|
||||
stream->writeULong((*it).first);
|
||||
stream->writeSingle((*it).second);
|
||||
}
|
||||
}
|
||||
|
@ -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)",
|
||||
|
|
|
@ -654,13 +654,13 @@ void GLRenderer::blitTexture(const GPUTexture *tex, bool flipVertically,
|
|||
|
||||
const float zDepth = -1.0f; // just before the far plane
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(upperLeft.x, upperLeft.y, zDepth);
|
||||
glVertex3f((float) upperLeft.x, (float) upperLeft.y, zDepth);
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(lowerRight.x, upperLeft.y, zDepth);
|
||||
glVertex3f((float) lowerRight.x, (float) upperLeft.y, zDepth);
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(lowerRight.x, lowerRight.y, zDepth);
|
||||
glVertex3f((float) lowerRight.x, (float) lowerRight.y, zDepth);
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(upperLeft.x, lowerRight.y, zDepth);
|
||||
glVertex3f((float) upperLeft.x, (float) lowerRight.y, zDepth);
|
||||
glEnd();
|
||||
} else if (tex->getType() == GPUTexture::ETextureCubeMap) {
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -737,7 +737,7 @@ void GLRenderer::blitTexture(const GPUTexture *tex, bool flipVertically,
|
|||
void GLRenderer::blitQuad(bool flipVertically) {
|
||||
GLint viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||
Vector2 scrSize(viewport[2], viewport[3]);
|
||||
Vector2 scrSize((float) viewport[2], (float) viewport[3]);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, scrSize.x, scrSize.y, 0, -1, 1);
|
||||
|
@ -830,11 +830,11 @@ void GLRenderer::drawText(const Point2i &_pos,
|
|||
|
||||
const Font::Glyph &glyph = font->getGlyph(character);
|
||||
|
||||
Point2i start = pos + Vector2i(
|
||||
Point2 start = Point2(pos + Vector2i(
|
||||
glyph.horizontalBearing,
|
||||
font->getMaxVerticalBearing() - glyph.verticalBearing
|
||||
);
|
||||
Point2i end = start + glyph.size;
|
||||
));
|
||||
Point2 end = start + Vector2(glyph.size);
|
||||
Point2 txStart = glyph.tx;
|
||||
Point2 txEnd = txStart + glyph.ts;
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ void GLTexture::refresh() {
|
|||
//Assert(m_size.x == m_size.y);
|
||||
|
||||
/* Anisotropic texture filtering */
|
||||
float anisotropy = getMaxAnisotropy();
|
||||
float anisotropy = (float) getMaxAnisotropy();
|
||||
if (anisotropy > 1.0f) {
|
||||
if (isMipMapped() && m_filterType == EMipMapLinear) {
|
||||
/* Only use anisotropy when it makes sense - otherwise some
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -95,7 +95,7 @@ bool SampleIntegrator::render(Scene *scene,
|
|||
const Sampler *sampler = static_cast<const Sampler *>(sched->getResource(samplerResID, 0));
|
||||
size_t sampleCount = sampler->getSampleCount();
|
||||
|
||||
Log(EInfo, "Starting render job (%ix%i, %lld %s, " SIZE_T_FMT
|
||||
Log(EInfo, "Starting render job (%ix%i, " SIZE_T_FMT " %s, " SIZE_T_FMT
|
||||
" %s, " SSE_STR ") ..", film->getCropSize().x, film->getCropSize().y,
|
||||
sampleCount, sampleCount == 1 ? "sample" : "samples", nCores,
|
||||
nCores == 1 ? "core" : "cores");
|
||||
|
|
|
@ -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) { }
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
SpotLuminaire(const Properties &props) : Luminaire(props) {
|
||||
m_intensity = props.getSpectrum("intensity", Spectrum(1.0f));
|
||||
m_cutoffAngle = props.getFloat("cutoffAngle", 20);
|
||||
m_beamWidth = props.getFloat("beamWidth", m_cutoffAngle * 3.0/4.0);
|
||||
m_beamWidth = props.getFloat("beamWidth", m_cutoffAngle * 3.0f/4.0f);
|
||||
m_beamWidth = degToRad(m_beamWidth);
|
||||
m_cutoffAngle = degToRad(m_cutoffAngle);
|
||||
Assert(m_cutoffAngle >= m_beamWidth);
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
m_cosCutoffAngle = std::cos(m_cutoffAngle);
|
||||
m_position = m_luminaireToWorld(Point(0, 0, 0));
|
||||
m_uvFactor = std::tan(m_beamWidth/2);
|
||||
m_invTransitionWidth = 1.0 / (m_cutoffAngle - m_beamWidth);
|
||||
m_invTransitionWidth = 1.0f / (m_cutoffAngle - m_beamWidth);
|
||||
}
|
||||
|
||||
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||
|
@ -91,8 +91,8 @@ public:
|
|||
if (m_texture->getClass() != MTS_CLASS(ConstantTexture)) {
|
||||
Intersection its;
|
||||
its.hasUVPartials = false;
|
||||
its.uv.x = .5+localDir.x / (localDir.z / m_uvFactor);
|
||||
its.uv.y = .5+localDir.y / (localDir.z / m_uvFactor);
|
||||
its.uv.x = 0.5f + localDir.x / (localDir.z / m_uvFactor);
|
||||
its.uv.y = 0.5f + localDir.y / (localDir.z / m_uvFactor);
|
||||
result *= m_texture->getValue(its);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ public:
|
|||
Float sample(PhaseFunctionQueryRecord &pRec,
|
||||
Float &pdf, Sampler *sampler) const {
|
||||
HGPhaseFunction::sample(pRec, sampler);
|
||||
return HGPhaseFunction::f(pRec);
|
||||
pdf = HGPhaseFunction::f(pRec);
|
||||
return pdf;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -41,6 +41,9 @@ class HairKDTree : public SAHKDTree3D<HairKDTree> {
|
|||
friend class GenericKDTree<AABB, SurfaceAreaHeuristic, HairKDTree>;
|
||||
friend class SAHKDTree3D<HairKDTree>;
|
||||
public:
|
||||
using SAHKDTree3D<HairKDTree>::index_type;
|
||||
using SAHKDTree3D<HairKDTree>::size_type;
|
||||
|
||||
HairKDTree(std::vector<Point> &vertices,
|
||||
std::vector<bool> &vertexStartsFiber, Float radius)
|
||||
: m_radius(radius) {
|
||||
|
@ -55,7 +58,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,8 +404,8 @@ public:
|
|||
#endif
|
||||
|
||||
/// Return the total number of segments
|
||||
inline int getPrimitiveCount() const {
|
||||
return m_segIndex.size();
|
||||
inline size_type getPrimitiveCount() const {
|
||||
return (size_type) m_segIndex.size();
|
||||
}
|
||||
|
||||
inline bool intersect(const Ray &ray, index_type iv,
|
||||
|
@ -581,7 +584,7 @@ public:
|
|||
Hair(Stream *stream, InstanceManager *manager)
|
||||
: Shape(stream, manager) {
|
||||
Float radius = stream->readFloat();
|
||||
size_t vertexCount = (size_t) stream->readUInt();
|
||||
size_t vertexCount = stream->readSize();
|
||||
|
||||
std::vector<Point> vertices(vertexCount);
|
||||
std::vector<bool> vertexStartsFiber(vertexCount+1);
|
||||
|
@ -601,7 +604,7 @@ public:
|
|||
const std::vector<bool> &vertexStartsFiber = m_kdtree->getStartFiber();
|
||||
|
||||
stream->writeFloat(m_kdtree->getRadius());
|
||||
stream->writeUInt((uint32_t) vertices.size());
|
||||
stream->writeSize(vertices.size());
|
||||
stream->writeFloatArray((Float *) &vertices[0], vertices.size() * 3);
|
||||
for (size_t i=0; i<vertices.size(); ++i)
|
||||
stream->writeBool(vertexStartsFiber[i]);
|
||||
|
@ -643,7 +646,7 @@ public:
|
|||
ref<TriMesh> createTriMesh() {
|
||||
size_t nSegments = m_kdtree->getSegmentCount();
|
||||
/// Use very approximate geometry for large hair meshes
|
||||
const size_t phiSteps = (nSegments > 100000) ? 4 : 10;
|
||||
const uint32_t phiSteps = (nSegments > 100000) ? 4 : 10;
|
||||
const Float dPhi = (2*M_PI) / phiSteps;
|
||||
|
||||
ref<TriMesh> mesh = new TriMesh("Hair mesh approximation",
|
||||
|
@ -664,10 +667,10 @@ public:
|
|||
cosPhi[i] = std::cos(i*dPhi);
|
||||
}
|
||||
|
||||
size_t hairIdx = 0;
|
||||
for (size_t iv=0; iv<hairVertices.size()-1; iv++) {
|
||||
uint32_t hairIdx = 0;
|
||||
for (HairKDTree::index_type iv=0; iv<(HairKDTree::index_type) hairVertices.size()-1; iv++) {
|
||||
if (!vertexStartsFiber[iv+1]) {
|
||||
for (size_t phi=0; phi<phiSteps; ++phi) {
|
||||
for (uint32_t phi=0; phi<phiSteps; ++phi) {
|
||||
Vector tangent = m_kdtree->tangent(iv);
|
||||
Vector dir = Frame(tangent).toWorld(
|
||||
Vector(cosPhi[phi], sinPhi[phi], 0));
|
||||
|
@ -682,8 +685,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' ||
|
||||
|
|
|
@ -392,7 +392,7 @@ inline void ply::ply_parser::parse_scalar_property_definition(const std::string&
|
|||
}
|
||||
if (!scalar_property_callback) {
|
||||
if (warning_callback_) {
|
||||
warning_callback_(line_number_, "property ‘" + std::string(type_traits<scalar_type>::name()) + " " + property_name + "’ of element ‘" + current_element_->name + "’ is not handled");
|
||||
warning_callback_(line_number_, "property '" + std::string(type_traits<scalar_type>::name()) + " " + property_name + "' of element '" + current_element_->name + "' is not handled");
|
||||
}
|
||||
}
|
||||
current_element_->properties.push_back(std::tr1::shared_ptr<property>(new scalar_property<scalar_type>(property_name, scalar_property_callback)));
|
||||
|
@ -416,7 +416,7 @@ inline void ply::ply_parser::parse_list_property_definition(const std::string& p
|
|||
}
|
||||
if (!std::tr1::get<0>(list_property_callbacks) || !std::tr1::get<1>(list_property_callbacks) || !std::tr1::get<2>(list_property_callbacks)) {
|
||||
if (warning_callback_) {
|
||||
warning_callback_(line_number_, "property ‘list " + std::string(type_traits<size_type>::name()) + " " + std::string(type_traits<scalar_type>::name()) + " " + property_name + "’ of element ‘" + current_element_->name + "’ is not handled");
|
||||
warning_callback_(line_number_, "property 'list " + std::string(type_traits<size_type>::name()) + " " + std::string(type_traits<scalar_type>::name()) + " " + property_name + "' of element '" + current_element_->name + "' is not handled");
|
||||
}
|
||||
}
|
||||
current_element_->properties.push_back(std::tr1::shared_ptr<property>(new list_property<size_type, scalar_type>(property_name, std::tr1::get<0>(list_property_callbacks), std::tr1::get<1>(list_property_callbacks), std::tr1::get<2>(list_property_callbacks))));
|
||||
|
|
|
@ -39,7 +39,7 @@ bool ply::ply_parser::parse(std::istream& istream)
|
|||
stringstream >> std::ws;
|
||||
if (stringstream.eof()) {
|
||||
if (warning_callback_) {
|
||||
warning_callback_(line_number_, "ignoring line ‘" + line + "’");
|
||||
warning_callback_(line_number_, "ignoring line '" + line + "'");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -74,7 +74,7 @@ bool ply::ply_parser::parse(std::istream& istream)
|
|||
}
|
||||
if (version != "1.0") {
|
||||
if (error_callback_) {
|
||||
error_callback_(line_number_, "version ‘" + version + "’ is not supported");
|
||||
error_callback_(line_number_, "version '" + version + "' is not supported");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ bool ply::ply_parser::parse(std::istream& istream)
|
|||
// unknown keyword
|
||||
else {
|
||||
if (warning_callback_) {
|
||||
warning_callback_(line_number_, "ignoring line ‘" + line + "’");
|
||||
warning_callback_(line_number_, "ignoring line '" + line + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ public:
|
|||
if (phi < 0)
|
||||
phi += 2*M_PI;
|
||||
|
||||
its.uv.x = phi * (0.5 * INV_PI);
|
||||
its.uv.x = phi * (0.5f * INV_PI);
|
||||
its.uv.y = theta * INV_PI;
|
||||
its.dpdu = m_objectToWorld(Vector(-local.y, local.x, 0) * (2*M_PI));
|
||||
its.geoFrame.n = normalize(its.p - m_center);
|
||||
|
@ -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)
|
||||
|
|
|
@ -71,9 +71,8 @@ public:
|
|||
NDIntegrator quad(1, 1, 1024, 0, 1e-5f);
|
||||
Float min = 0, max = 10, result, err;
|
||||
size_t evals;
|
||||
assertEquals(quad.integrate(boost::bind(
|
||||
&TestQuadrature::testF2, this, _1, _2), &min, &max, &result, &err, evals),
|
||||
NDIntegrator::ESuccess);
|
||||
assertTrue(quad.integrate(boost::bind(
|
||||
&TestQuadrature::testF2, this, _1, _2), &min, &max, &result, &err, evals) == NDIntegrator::ESuccess);
|
||||
Float ref = 2 * std::pow(std::sin(5.0f), 2.0f);
|
||||
Log(EInfo, "test02_nD_01(): used " SIZE_T_FMT " function evaluations, "
|
||||
"error=%f", evals, err);
|
||||
|
@ -84,9 +83,8 @@ public:
|
|||
NDIntegrator quad(2, 3, 1000000, 0, 1e-5f);
|
||||
size_t evals;
|
||||
Float min[3] = { -1, -1, -1 } , max[3] = { 1, 1, 1 }, result[2], err[2];
|
||||
assertEquals(quad.integrateVectorized(boost::bind(
|
||||
&TestQuadrature::testF3, this, _1, _2, _3), min, max, result, err, evals),
|
||||
NDIntegrator::ESuccess);
|
||||
assertTrue(quad.integrateVectorized(boost::bind(
|
||||
&TestQuadrature::testF3, this, _1, _2, _3), min, max, result, err, evals) == NDIntegrator::ESuccess);
|
||||
Log(EInfo, "test02_nD_02(): used " SIZE_T_FMT " function evaluations, "
|
||||
"error=[%f, %f]", evals, err[0], err[1]);
|
||||
assertEqualsEpsilon(result[0], 1, 1e-5f);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ public:
|
|||
m_gpuTexture->setWrapType(GPUTexture::ERepeat);
|
||||
else
|
||||
m_gpuTexture->setWrapType(GPUTexture::EClampToEdge);
|
||||
m_gpuTexture->setMaxAnisotropy((int) maxAnisotropy);
|
||||
m_gpuTexture->setMaxAnisotropy(maxAnisotropy);
|
||||
m_gpuTexture->init();
|
||||
/* Release the memory on the host side */
|
||||
m_gpuTexture->setBitmap(0, NULL);
|
||||
|
|
|
@ -84,17 +84,17 @@ public:
|
|||
fitParameters = true;
|
||||
break;
|
||||
case 'i':
|
||||
intersectionCost = strtod(optarg, &end_ptr);
|
||||
intersectionCost = (Float) strtod(optarg, &end_ptr);
|
||||
if (*end_ptr != '\0')
|
||||
SLog(EError, "Could not parse the intersection cost!");
|
||||
break;
|
||||
case 't':
|
||||
traversalCost = strtod(optarg, &end_ptr);
|
||||
traversalCost = (Float) strtod(optarg, &end_ptr);
|
||||
if (*end_ptr != '\0')
|
||||
SLog(EError, "Could not parse the traversal cost!");
|
||||
break;
|
||||
case 'e':
|
||||
emptySpaceBonus = strtod(optarg, &end_ptr);
|
||||
emptySpaceBonus = (Float) strtod(optarg, &end_ptr);
|
||||
if (*end_ptr != '\0')
|
||||
SLog(EError, "Could not parse the empty space bonus!");
|
||||
break;
|
||||
|
|
|
@ -62,12 +62,12 @@ public:
|
|||
}
|
||||
break;
|
||||
case 'g':
|
||||
gamma = strtod(optarg, &end_ptr);
|
||||
gamma = (Float) strtod(optarg, &end_ptr);
|
||||
if (*end_ptr != '\0')
|
||||
SLog(EError, "Could not parse the gamma value!");
|
||||
break;
|
||||
case 'm':
|
||||
multiplier = strtod(optarg, &end_ptr);
|
||||
multiplier = (Float) strtod(optarg, &end_ptr);
|
||||
if (*end_ptr != '\0')
|
||||
SLog(EError, "Could not parse the multiplier!");
|
||||
break;
|
||||
|
|
|
@ -131,8 +131,8 @@ public:
|
|||
Log(EInfo, " Memory limit per core = %s", memString(memoryLimitPerCore).c_str());
|
||||
Log(EInfo, " Max. blocks per core = %i", m_blocksPerCore);
|
||||
Log(EInfo, " Effective resolution = %s", totalCells.toString().c_str());
|
||||
Log(EInfo, " Effective storage = %s", memString(
|
||||
totalCells[0]*totalCells[1]*totalCells[2]*sizeof(float)*m_channels).c_str());
|
||||
Log(EInfo, " Effective storage = %s", memString((size_t)
|
||||
(totalCells[0]*totalCells[1]*totalCells[2]*sizeof(float)*m_channels)).c_str());
|
||||
}
|
||||
|
||||
Float lookupFloat(const Point &_p) const {
|
||||
|
@ -263,7 +263,7 @@ public:
|
|||
for (int z = 0; z<m_blockRes; ++z) {
|
||||
for (int y = 0; y<m_blockRes; ++y) {
|
||||
for (int x = 0; x<m_blockRes; ++x) {
|
||||
Point p = offset + Vector(x, y, z) * m_voxelWidth;
|
||||
Point p = offset + Vector((Float) x, (Float) y, (Float) z) * m_voxelWidth;
|
||||
float value = (float) m_nested->lookupFloat(p);
|
||||
result[idx++] = value;
|
||||
nonempty |= (value != 0);
|
||||
|
|
Loading…
Reference in New Issue