hslt: misc improved functionality:
texture formats matrix 2x2 inversion special case (wasn't called before) more meaningful flags on vertex.metadata
parent
5d578e9c68
commit
6fb326038e
|
@ -75,7 +75,7 @@ struct RestoreMeasureHelper {
|
|||
: vertex(vertex), measure(vertex->measure) { }
|
||||
~RestoreMeasureHelper() { vertex->measure = measure; }
|
||||
PathVertex *vertex;
|
||||
uint8_t measure;
|
||||
EMeasure measure;
|
||||
};
|
||||
|
||||
MTS_NAMESPACE_END
|
||||
|
|
|
@ -91,7 +91,7 @@ struct MTS_EXPORT_BIDIR PathVertex {
|
|||
*
|
||||
* \sa EVertexType
|
||||
*/
|
||||
uint8_t type : 7;
|
||||
EVertexType type : 7;
|
||||
|
||||
/**
|
||||
* \brief Denotes whether this vertex \a only supports
|
||||
|
@ -129,7 +129,7 @@ struct MTS_EXPORT_BIDIR PathVertex {
|
|||
*
|
||||
* \sa EMeasure
|
||||
*/
|
||||
uint8_t measure;
|
||||
EMeasure measure : 8;
|
||||
|
||||
/**
|
||||
* \brief When the current vertex supports sampling
|
||||
|
|
|
@ -96,6 +96,12 @@ struct Frame {
|
|||
return v.z;
|
||||
}
|
||||
|
||||
/** \brief Assuming that the given direction is in the local coordinate
|
||||
* system, return the u and v coordinates of the vector 'v' */
|
||||
inline static Vector2 uv(const Vector &v) {
|
||||
return Vector2(v.x, v.y);
|
||||
}
|
||||
|
||||
/** \brief Assuming that the given direction is in the local coordinate
|
||||
* system, return the squared sine of the angle between the normal and v */
|
||||
inline static Float sinTheta2(const Vector &v) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
/**
|
||||
* \brief Construct a new MxN matrix without initializing it.
|
||||
*
|
||||
* This construtor is useful when the matrix will either not
|
||||
* This constructor is useful when the matrix will either not
|
||||
* be used at all (it might be part of a larger data structure)
|
||||
* or initialized at a later point in time. Always make sure
|
||||
* that one of the two is the case! Otherwise your program will do
|
||||
|
@ -291,7 +291,7 @@ public:
|
|||
* and a permutation vector piv of length m so that A(piv,:) = L*U.
|
||||
* If m < n, then L is m-by-m and U is m-by-n.
|
||||
*
|
||||
* The LU decompostion with pivoting always exists, even if the matrix is
|
||||
* The LU decomposition with pivoting always exists, even if the matrix is
|
||||
* singular, so the constructor will never fail.
|
||||
* The primary use of the
|
||||
*
|
||||
|
@ -361,7 +361,7 @@ public:
|
|||
|
||||
T cholDet() const;
|
||||
|
||||
/// Check if the matrix is identically zeor
|
||||
/// Check if the matrix is identically zero
|
||||
inline bool isZero() const {
|
||||
for (int i=0; i<M; ++i)
|
||||
for (int j=0; j<N; ++j)
|
||||
|
@ -489,7 +489,7 @@ public:
|
|||
}
|
||||
|
||||
/// Compute the inverse (Faster than Matrix::invert)
|
||||
FINLINE bool invert(Matrix2x2 &target) const {
|
||||
FINLINE bool invert2x2(Matrix2x2 &target) const {
|
||||
Float det = m[0][0]*m[1][1] - m[0][1]*m[1][0];
|
||||
if (std::abs(det) <= RCPOVERFLOW)
|
||||
return false;
|
||||
|
@ -500,6 +500,22 @@ public:
|
|||
target.m[1][0] = -m[1][0] * invDet;
|
||||
return true;
|
||||
}
|
||||
FINLINE bool invert(Matrix2x2 &target) const {
|
||||
return invert2x2(target);
|
||||
}
|
||||
|
||||
/// Compute the inverse with det (Faster than Matrix::invert)
|
||||
FINLINE bool invert2x2(Matrix2x2 &target, Float& det) const {
|
||||
det = m[0][0]*m[1][1] - m[0][1]*m[1][0];
|
||||
if(std::abs(det) <= RCPOVERFLOW)
|
||||
return false;
|
||||
Float invDet = 1/det;
|
||||
target.m[0][0] = m[1][1] * invDet;
|
||||
target.m[0][1] = -m[0][1] * invDet;
|
||||
target.m[1][1] = m[0][0] * invDet;
|
||||
target.m[1][0] = -m[1][0] * invDet;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Matrix-vector multiplication
|
||||
inline Vector2 operator*(const Vector2 &v) const {
|
||||
|
|
|
@ -167,6 +167,13 @@ struct RayDifferential : public Ray {
|
|||
ryDirection = d + (ryDirection - d) * amount;
|
||||
}
|
||||
|
||||
void scaleDifferentialUV(const Vector2 amountUV) {
|
||||
rxOrigin = o + (rxOrigin - o) * amountUV.x;
|
||||
ryOrigin = o + (ryOrigin - o) * amountUV.y;
|
||||
rxDirection = d + (rxDirection - d) * amountUV.x;
|
||||
ryDirection = d + (ryDirection - d) * amountUV.y;
|
||||
}
|
||||
|
||||
inline void operator=(const RayDifferential &ray) {
|
||||
o = ray.o;
|
||||
mint = ray.mint;
|
||||
|
|
|
@ -362,7 +362,18 @@ void GLTexture::lookupGLConstants() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_componentFormat == EFloat16) {
|
||||
if (m_componentFormat == EUInt8) {
|
||||
switch (m_pixelFormat) {
|
||||
case ELuminance: m_internalFormat = GL_LUMINANCE8; break;
|
||||
case ELuminanceAlpha: m_internalFormat = GL_LUMINANCE8_ALPHA8; break;
|
||||
case ERGB: m_internalFormat = GL_RGB8; break;
|
||||
case ERGBA: m_internalFormat = GL_RGBA8; break;
|
||||
default:
|
||||
Log(EError, "Unknown/unsupported pixel format!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (m_componentFormat == EFloat16) {
|
||||
switch (m_pixelFormat) {
|
||||
case ELuminance: m_internalFormat = GL_LUMINANCE16F_ARB; break;
|
||||
case ELuminanceAlpha: m_internalFormat = GL_LUMINANCE_ALPHA16F_ARB; break;
|
||||
|
|
Loading…
Reference in New Issue