fixed converter, nicer gridtexture class
parent
0c8e6f7a5c
commit
83325389fc
|
@ -292,6 +292,9 @@ void writeGeometry(std::string prefixName, std::string id, int geomIndex, std::s
|
||||||
if (vData->typeToOffset[EUV] != -1) {
|
if (vData->typeToOffset[EUV] != -1) {
|
||||||
domUint uvRef = tess_data[i+vData->typeToOffsetInStream[EUV]];
|
domUint uvRef = tess_data[i+vData->typeToOffsetInStream[EUV]];
|
||||||
vertex.uv = vData->data[vData->typeToOffset[EUV]][uvRef].toPoint2();
|
vertex.uv = vData->data[vData->typeToOffset[EUV]][uvRef].toPoint2();
|
||||||
|
#if 1
|
||||||
|
vertex.uv.y = 1-vertex.uv.y; // Invert the V coordinate
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int key = -1;
|
int key = -1;
|
||||||
|
@ -670,18 +673,11 @@ void loadMaterial(GeometryConverter *cvt, std::ostream &os, domMaterial &mat, St
|
||||||
os << "\t</bsdf>" << endl << endl;
|
os << "\t</bsdf>" << endl << endl;
|
||||||
}
|
}
|
||||||
} else if (lambert) {
|
} else if (lambert) {
|
||||||
domCommon_float_or_param_type* transparency = lambert->getTransparency();
|
domCommon_color_or_texture_type* diffuse = lambert->getDiffuse();
|
||||||
domCommon_float_or_param_type::domFloat *transparencyValue =
|
os << "\t<bsdf id=\"" << identifier << "\" type=\"lambertian\">" << endl;
|
||||||
transparency ? transparency->getFloat() : NULL;
|
loadMaterialParam(cvt, os, "reflectance", idToTexture, diffuse, false);
|
||||||
if (transparencyValue && transparencyValue->getValue() > 0.5) {
|
loadMaterialParam(cvt, os, "reflectance", idToTexture, diffuse, true);
|
||||||
os << "\t<bsdf id=\"" << identifier << "\" type=\"dielectric\"/>" << endl << endl;
|
os << "\t</bsdf>" << endl << endl;
|
||||||
} else {
|
|
||||||
domCommon_color_or_texture_type* diffuse = lambert->getDiffuse();
|
|
||||||
os << "\t<bsdf id=\"" << identifier << "\" type=\"lambertian\">" << endl;
|
|
||||||
loadMaterialParam(cvt, os, "reflectance", idToTexture, diffuse, false);
|
|
||||||
loadMaterialParam(cvt, os, "reflectance", idToTexture, diffuse, true);
|
|
||||||
os << "\t</bsdf>" << endl << endl;
|
|
||||||
}
|
|
||||||
} else if (blinn) {
|
} else if (blinn) {
|
||||||
SLog(EWarn, "\"%s\": Encountered a \"blinn\" COLLADA material, which is currently "
|
SLog(EWarn, "\"%s\": Encountered a \"blinn\" COLLADA material, which is currently "
|
||||||
"unsupported in Mitsuba -- replacing it using a Phong material.", identifier.c_str());
|
"unsupported in Mitsuba -- replacing it using a Phong material.", identifier.c_str());
|
||||||
|
|
|
@ -28,18 +28,21 @@ MTS_NAMESPACE_BEGIN
|
||||||
class GridTexture : public Texture {
|
class GridTexture : public Texture {
|
||||||
public:
|
public:
|
||||||
GridTexture(const Properties &props) : Texture(props) {
|
GridTexture(const Properties &props) : Texture(props) {
|
||||||
m_reflectance = props.getSpectrum("reflectance", Spectrum(.5f));
|
m_brightReflectance = props.getSpectrum("brightReflectance", Spectrum(.4f));
|
||||||
|
m_darkReflectance = props.getSpectrum("darkReflectance", Spectrum(.2f));
|
||||||
m_width = props.getFloat("width", .01f);
|
m_width = props.getFloat("width", .01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
GridTexture(Stream *stream, InstanceManager *manager)
|
GridTexture(Stream *stream, InstanceManager *manager)
|
||||||
: Texture(stream, manager) {
|
: Texture(stream, manager) {
|
||||||
m_reflectance = Spectrum(stream);
|
m_brightReflectance = Spectrum(stream);
|
||||||
|
m_darkReflectance = Spectrum(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialize(Stream *stream, InstanceManager *manager) const {
|
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||||
Texture::serialize(stream, manager);
|
Texture::serialize(stream, manager);
|
||||||
m_reflectance.serialize(stream);
|
m_brightReflectance.serialize(stream);
|
||||||
|
m_darkReflectance.serialize(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
Spectrum getValue(const Intersection &its) const {
|
Spectrum getValue(const Intersection &its) const {
|
||||||
|
@ -52,9 +55,9 @@ public:
|
||||||
y-=1;
|
y-=1;
|
||||||
|
|
||||||
if (std::abs(x) < m_width || std::abs(y) < m_width)
|
if (std::abs(x) < m_width || std::abs(y) < m_width)
|
||||||
return Spectrum(0.0f);
|
return m_darkReflectance;
|
||||||
else
|
else
|
||||||
return m_reflectance;
|
return m_brightReflectance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usesRayDifferentials() const {
|
bool usesRayDifferentials() const {
|
||||||
|
@ -62,11 +65,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Spectrum getMaximum() const {
|
Spectrum getMaximum() const {
|
||||||
return m_reflectance;
|
return m_brightReflectance;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spectrum getAverage() const {
|
Spectrum getAverage() const {
|
||||||
return m_reflectance; // that's not quite right
|
return m_brightReflectance; // that's not quite right
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
|
@ -75,7 +78,8 @@ public:
|
||||||
|
|
||||||
MTS_DECLARE_CLASS()
|
MTS_DECLARE_CLASS()
|
||||||
protected:
|
protected:
|
||||||
Spectrum m_reflectance;
|
Spectrum m_brightReflectance;
|
||||||
|
Spectrum m_darkReflectance;
|
||||||
Float m_width;
|
Float m_width;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue