mtsutil feature is done
parent
1867232a89
commit
094a0226b6
|
@ -11,7 +11,7 @@ MTS_NAMESPACE_BEGIN
|
||||||
*/
|
*/
|
||||||
class MTS_EXPORT_RENDER UtilityServices {
|
class MTS_EXPORT_RENDER UtilityServices {
|
||||||
public:
|
public:
|
||||||
virtual Scene *loadScene(const std::string &filename) = 0;
|
virtual ref<Scene> loadScene(const std::string &filename) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Abstract utility class -- can be used to implement
|
/** \brief Abstract utility class -- can be used to implement
|
||||||
|
@ -38,7 +38,7 @@ protected:
|
||||||
virtual ~Utility() { }
|
virtual ~Utility() { }
|
||||||
|
|
||||||
/// Load a scene
|
/// Load a scene
|
||||||
inline Scene *loadScene(const std::string &fname) {
|
inline ref<Scene> loadScene(const std::string &fname) {
|
||||||
return m_utilityServices->loadScene(fname);
|
return m_utilityServices->loadScene(fname);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -260,7 +260,7 @@ public:
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Microfacet["
|
oss << "Microfacet[" << endl
|
||||||
<< " diffuseReflectance = " << indent(m_diffuseReflectance->toString()) << "," << endl
|
<< " diffuseReflectance = " << indent(m_diffuseReflectance->toString()) << "," << endl
|
||||||
<< " specularReflectance = " << indent(m_specularReflectance->toString()) << "," << endl
|
<< " specularReflectance = " << indent(m_specularReflectance->toString()) << "," << endl
|
||||||
<< " intIOR = " << m_intIOR << "," << endl
|
<< " intIOR = " << m_intIOR << "," << endl
|
||||||
|
|
|
@ -219,7 +219,7 @@ public:
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Phong["
|
oss << "Phong[" << endl
|
||||||
<< " diffuseReflectance = " << indent(m_diffuseReflectance->toString()) << "," << endl
|
<< " diffuseReflectance = " << indent(m_diffuseReflectance->toString()) << "," << endl
|
||||||
<< " specularReflectance = " << indent(m_specularReflectance->toString()) << "," << endl
|
<< " specularReflectance = " << indent(m_specularReflectance->toString()) << "," << endl
|
||||||
<< " exponent = " << m_exponent << endl
|
<< " exponent = " << m_exponent << endl
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
MTS_NAMESPACE_BEGIN
|
MTS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Microfacet BRDF model based on
|
* Rough metal BRDF model based on
|
||||||
* "Microfacet Models for Refraction through Rough Surfaces"
|
* "Microfacet Models for Refraction through Rough Surfaces"
|
||||||
* by Bruce Walter, Stephen R. Marschner, Hongsong Li
|
* by Bruce Walter, Stephen R. Marschner, Hongsong Li
|
||||||
* and Kenneth E. Torrance.
|
* and Kenneth E. Torrance.
|
||||||
|
@ -11,9 +11,9 @@ MTS_NAMESPACE_BEGIN
|
||||||
* This is similar to the 'microfacet' implementation, but
|
* This is similar to the 'microfacet' implementation, but
|
||||||
* the Fresnel term is now that of a conductor.
|
* the Fresnel term is now that of a conductor.
|
||||||
*/
|
*/
|
||||||
class Microfacet : public BSDF {
|
class RoughMetal : public BSDF {
|
||||||
public:
|
public:
|
||||||
Microfacet(const Properties &props)
|
RoughMetal(const Properties &props)
|
||||||
: BSDF(props) {
|
: BSDF(props) {
|
||||||
m_specularReflectance = props.getSpectrum("specularReflectance",
|
m_specularReflectance = props.getSpectrum("specularReflectance",
|
||||||
Spectrum(1.0f));
|
Spectrum(1.0f));
|
||||||
|
@ -27,7 +27,7 @@ public:
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Microfacet(Stream *stream, InstanceManager *manager)
|
RoughMetal(Stream *stream, InstanceManager *manager)
|
||||||
: BSDF(stream, manager) {
|
: BSDF(stream, manager) {
|
||||||
m_specularReflectance = Spectrum(stream);
|
m_specularReflectance = Spectrum(stream);
|
||||||
m_alphaB = stream->readFloat();
|
m_alphaB = stream->readFloat();
|
||||||
|
@ -40,7 +40,7 @@ public:
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Microfacet() {
|
virtual ~RoughMetal() {
|
||||||
delete[] m_type;
|
delete[] m_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public:
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Microfacet["
|
oss << "RoughMetal[" << endl
|
||||||
<< " specularReflectance=" << m_specularReflectance.toString() << "," << std::endl
|
<< " specularReflectance=" << m_specularReflectance.toString() << "," << std::endl
|
||||||
<< ", ior=" << m_ior.toString() << "," << std::endl
|
<< ", ior=" << m_ior.toString() << "," << std::endl
|
||||||
<< ", k=" << m_k.toString() << "," << std::endl
|
<< ", k=" << m_k.toString() << "," << std::endl
|
||||||
|
@ -172,6 +172,6 @@ private:
|
||||||
Spectrum m_ior, m_k;
|
Spectrum m_ior, m_k;
|
||||||
};
|
};
|
||||||
|
|
||||||
MTS_IMPLEMENT_CLASS_S(Microfacet, false, BSDF)
|
MTS_IMPLEMENT_CLASS_S(RoughMetal, false, BSDF)
|
||||||
MTS_EXPORT_PLUGIN(Microfacet, "Microfacet BRDF");
|
MTS_EXPORT_PLUGIN(RoughMetal, "Rough metal BRDF");
|
||||||
MTS_NAMESPACE_END
|
MTS_NAMESPACE_END
|
||||||
|
|
|
@ -115,9 +115,31 @@ private:
|
||||||
|
|
||||||
class UtilityServicesImpl : public UtilityServices {
|
class UtilityServicesImpl : public UtilityServices {
|
||||||
public:
|
public:
|
||||||
Scene *loadScene(const std::string &filename) {
|
ref<Scene> loadScene(const std::string &filename) {
|
||||||
cout << "asdf" << endl;
|
/* Prepare for parsing scene descriptions */
|
||||||
return NULL;
|
FileResolver *resolver = FileResolver::getInstance();
|
||||||
|
SAXParser* parser = new SAXParser();
|
||||||
|
std::string schemaPath = resolver->resolveAbsolute("schema/scene.xsd");
|
||||||
|
|
||||||
|
/* Check against the 'scene.xsd' XML Schema */
|
||||||
|
parser->setDoSchema(true);
|
||||||
|
parser->setValidationSchemaFullChecking(true);
|
||||||
|
parser->setValidationScheme(SAXParser::Val_Always);
|
||||||
|
parser->setExternalNoNamespaceSchemaLocation(schemaPath.c_str());
|
||||||
|
|
||||||
|
std::map<std::string, std::string> parameters;
|
||||||
|
SceneHandler *handler = new SceneHandler(parameters);
|
||||||
|
parser->setDoNamespaces(true);
|
||||||
|
parser->setDocumentHandler(handler);
|
||||||
|
parser->setErrorHandler(handler);
|
||||||
|
|
||||||
|
parser->parse(filename.c_str());
|
||||||
|
ref<Scene> scene = handler->getScene();
|
||||||
|
|
||||||
|
delete parser;
|
||||||
|
delete handler;
|
||||||
|
|
||||||
|
return scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue