generalized the XML schema
parent
58a2f5eacb
commit
87ac8b57bd
|
@ -329,7 +329,7 @@ librender = renderEnv.SharedLibrary('src/librender/mitsuba-render', [
|
||||||
'src/librender/preview.cpp', 'src/librender/photonmap.cpp',
|
'src/librender/preview.cpp', 'src/librender/photonmap.cpp',
|
||||||
'src/librender/gatherproc.cpp', 'src/librender/mipmap3d.cpp',
|
'src/librender/gatherproc.cpp', 'src/librender/mipmap3d.cpp',
|
||||||
'src/librender/volume.cpp', 'src/librender/vpl.cpp',
|
'src/librender/volume.cpp', 'src/librender/vpl.cpp',
|
||||||
'src/librender/shader.cpp', 'src/librender/shandler.cpp',
|
'src/librender/shader.cpp', 'src/librender/scenehandler.cpp',
|
||||||
'src/librender/intersection.cpp', 'src/librender/track.cpp'
|
'src/librender/intersection.cpp', 'src/librender/track.cpp'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:element name="camera" type="camera"/>
|
<xsd:element name="camera" type="camera"/>
|
||||||
<xsd:element name="texture" type="object"/>
|
<xsd:element name="texture" type="texture"/>
|
||||||
<xsd:element name="bsdf" type="bsdf"/>
|
<xsd:element name="bsdf" type="bsdf"/>
|
||||||
<xsd:element name="integrator" type="integrator"/>
|
<xsd:element name="integrator" type="integrator"/>
|
||||||
<xsd:element name="luminaire" type="luminaire"/>
|
<xsd:element name="luminaire" type="luminaire"/>
|
||||||
|
@ -29,9 +29,9 @@
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- Generic Object -->
|
<!-- Generic Object -->
|
||||||
<xsd:complexType name="object">
|
<xsd:group name="objectGroup">
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<!-- Allow all property types -->
|
||||||
<!-- Usual attributes -->
|
<xsd:choice>
|
||||||
<xsd:element name="integer" type="integer"/>
|
<xsd:element name="integer" type="integer"/>
|
||||||
<xsd:element name="float" type="float"/>
|
<xsd:element name="float" type="float"/>
|
||||||
<xsd:element name="point" type="point"/>
|
<xsd:element name="point" type="point"/>
|
||||||
|
@ -44,12 +44,27 @@
|
||||||
<xsd:element name="srgb" type="string"/>
|
<xsd:element name="srgb" type="string"/>
|
||||||
<xsd:element name="blackbody" type="blackbody"/>
|
<xsd:element name="blackbody" type="blackbody"/>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
|
</xsd:group>
|
||||||
|
|
||||||
|
<xsd:complexType name="objectBase">
|
||||||
<xsd:attribute name="type" type="xsd:string" use="required"/>
|
<xsd:attribute name="type" type="xsd:string" use="required"/>
|
||||||
<xsd:attribute name="name" type="xsd:string"/>
|
<xsd:attribute name="name" type="xsd:string"/>
|
||||||
<xsd:attribute name="id" type="xsd:string"/>
|
<xsd:attribute name="id" type="xsd:string"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
|
|
||||||
<!-- Object reference -->
|
<xsd:complexType name="object">
|
||||||
|
<xsd:complexContent>
|
||||||
|
<xsd:extension base="objectBase">
|
||||||
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:extension>
|
||||||
|
</xsd:complexContent>
|
||||||
|
</xsd:complexType>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- REFERENCE -->
|
||||||
<xsd:complexType name="reference">
|
<xsd:complexType name="reference">
|
||||||
<xsd:attribute name="id" type="xsd:string" use="required"/>
|
<xsd:attribute name="id" type="xsd:string" use="required"/>
|
||||||
<xsd:attribute name="name" type="xsd:string"/>
|
<xsd:attribute name="name" type="xsd:string"/>
|
||||||
|
@ -58,8 +73,9 @@
|
||||||
<!-- CAMERA Element -->
|
<!-- CAMERA Element -->
|
||||||
<xsd:complexType name="camera">
|
<xsd:complexType name="camera">
|
||||||
<xsd:complexContent>
|
<xsd:complexContent>
|
||||||
<xsd:extension base="object">
|
<xsd:extension base="objectBase">
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
<xsd:element name="sampler" type="object"/>
|
<xsd:element name="sampler" type="object"/>
|
||||||
<xsd:element name="film" type="film"/>
|
<xsd:element name="film" type="film"/>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
|
@ -70,33 +86,44 @@
|
||||||
<!-- INTEGRATOR Element -->
|
<!-- INTEGRATOR Element -->
|
||||||
<xsd:complexType name="integrator">
|
<xsd:complexType name="integrator">
|
||||||
<xsd:complexContent>
|
<xsd:complexContent>
|
||||||
<xsd:extension base="object">
|
<xsd:extension base="objectBase">
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
<xsd:element name="integrator" type="integrator"/>
|
<xsd:element name="integrator" type="integrator"/>
|
||||||
<xsd:element name="sampler" type="object"/>
|
<xsd:element name="sampler" type="object"/>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
</xsd:extension>
|
</xsd:extension>
|
||||||
</xsd:complexContent>
|
</xsd:complexContent>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<!-- LUMINAIRE Element -->
|
<!-- LUMINAIRE Element -->
|
||||||
<xsd:complexType name="luminaire">
|
<xsd:complexType name="luminaire">
|
||||||
<xsd:complexContent>
|
<xsd:complexContent>
|
||||||
<xsd:extension base="object">
|
<xsd:extension base="object">
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:element name="texture" type="object"/>
|
<xsd:element name="texture" type="texture"/>
|
||||||
<xsd:element name="luminaire" type="luminaire"/>
|
<xsd:element name="luminaire" type="luminaire"/>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
</xsd:extension>
|
</xsd:extension>
|
||||||
</xsd:complexContent>
|
</xsd:complexContent>
|
||||||
|
<xsd:complexContent>
|
||||||
|
<xsd:extension base="objectBase">
|
||||||
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
|
<xsd:element name="integrator" type="integrator"/>
|
||||||
|
<xsd:element name="sampler" type="object"/>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:extension>
|
||||||
|
</xsd:complexContent>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
|
|
||||||
<!-- SHAPE Element -->
|
<!-- SHAPE Element -->
|
||||||
<xsd:complexType name="shape">
|
<xsd:complexType name="shape">
|
||||||
<xsd:complexContent>
|
<xsd:complexContent>
|
||||||
<xsd:extension base="object">
|
<xsd:extension base="objectBase">
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
<xsd:element name="bsdf" type="bsdf"/>
|
<xsd:element name="bsdf" type="bsdf"/>
|
||||||
<xsd:element name="subsurface" type="object"/>
|
<xsd:element name="subsurface" type="object"/>
|
||||||
<xsd:element name="ref" type="reference"/>
|
<xsd:element name="ref" type="reference"/>
|
||||||
|
@ -110,12 +137,12 @@
|
||||||
<!-- VOLUMEREGION Element -->
|
<!-- VOLUMEREGION Element -->
|
||||||
<xsd:complexType name="medium">
|
<xsd:complexType name="medium">
|
||||||
<xsd:complexContent>
|
<xsd:complexContent>
|
||||||
<xsd:extension base="object">
|
<xsd:extension base="objectBase">
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
<xsd:element name="shape" type="shape"/>
|
<xsd:element name="shape" type="shape"/>
|
||||||
<xsd:element name="volume" type="object"/>
|
<xsd:element name="volume" type="object"/>
|
||||||
<xsd:element name="phase" type="phase"/>
|
<xsd:element name="phase" type="phase"/>
|
||||||
<xsd:element name="ref" type="reference"/>
|
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
</xsd:extension>
|
</xsd:extension>
|
||||||
</xsd:complexContent>
|
</xsd:complexContent>
|
||||||
|
@ -124,9 +151,10 @@
|
||||||
<!-- BSDF Element -->
|
<!-- BSDF Element -->
|
||||||
<xsd:complexType name="bsdf">
|
<xsd:complexType name="bsdf">
|
||||||
<xsd:complexContent>
|
<xsd:complexContent>
|
||||||
<xsd:extension base="object">
|
<xsd:extension base="objectBase">
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:element name="texture" type="object"/>
|
<xsd:group ref="objectGroup"/>
|
||||||
|
<xsd:element name="texture" type="texture"/>
|
||||||
<xsd:element name="bsdf" type="bsdf"/>
|
<xsd:element name="bsdf" type="bsdf"/>
|
||||||
<xsd:element name="ref" type="reference"/>
|
<xsd:element name="ref" type="reference"/>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
|
@ -134,24 +162,41 @@
|
||||||
</xsd:complexContent>
|
</xsd:complexContent>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<!-- Phase Element -->
|
<!-- TEXTURE Element -->
|
||||||
<xsd:complexType name="phase">
|
<xsd:complexType name="texture">
|
||||||
<xsd:complexContent>
|
<xsd:complexContent>
|
||||||
<xsd:extension base="object"/>
|
<xsd:extension base="objectBase">
|
||||||
</xsd:complexContent>
|
|
||||||
</xsd:complexType>
|
|
||||||
|
|
||||||
<!-- Film Element -->
|
|
||||||
<xsd:complexType name="film">
|
|
||||||
<xsd:complexContent>
|
|
||||||
<xsd:extension base="object">
|
|
||||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:element name="rfilter" type="object"/>
|
<xsd:group ref="objectGroup"/>
|
||||||
|
<xsd:element name="texture" type="texture"/>
|
||||||
|
<xsd:element name="ref" type="reference"/>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
</xsd:extension>
|
</xsd:extension>
|
||||||
</xsd:complexContent>
|
</xsd:complexContent>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
|
<!-- PHASE Element -->
|
||||||
|
<xsd:complexType name="phase">
|
||||||
|
<xsd:complexContent>
|
||||||
|
<xsd:extension base="objectBase">
|
||||||
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:extension>
|
||||||
|
</xsd:complexContent>
|
||||||
|
</xsd:complexType>
|
||||||
|
|
||||||
|
<!-- FILM Element -->
|
||||||
|
<xsd:complexType name="film">
|
||||||
|
<xsd:complexContent>
|
||||||
|
<xsd:extension base="objectBase">
|
||||||
|
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xsd:group ref="objectGroup"/>
|
||||||
|
<xsd:element name="rfilter" type="object"/>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:extension>
|
||||||
|
</xsd:complexContent>
|
||||||
|
</xsd:complexType>
|
||||||
|
|
||||||
<!-- Types and parameters -->
|
<!-- Types and parameters -->
|
||||||
<xsd:simpleType name="integerType">
|
<xsd:simpleType name="integerType">
|
||||||
|
@ -196,15 +241,16 @@
|
||||||
</xsd:union>
|
</xsd:union>
|
||||||
</xsd:simpleType>
|
</xsd:simpleType>
|
||||||
|
|
||||||
|
|
||||||
<xsd:complexType name="float">
|
<xsd:complexType name="float">
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||||
<xsd:attribute name="value" type="doubleType" use="required"/>
|
<xsd:attribute name="value" type="doubleType" use="required"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:complexType name="integer">
|
<xsd:complexType name="integer">
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||||
<xsd:attribute name="value" type="integerType" use="required"/>
|
<xsd:attribute name="value" type="integerType" use="required"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:complexType name="boolean">
|
<xsd:complexType name="boolean">
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||||
<xsd:attribute name="value" type="booleanType" use="required"/>
|
<xsd:attribute name="value" type="booleanType" use="required"/>
|
||||||
|
|
|
@ -1141,28 +1141,14 @@ void loadCamera(ColladaContext &ctx, Transform transform, domCamera &camera) {
|
||||||
ctx.os << "\t<camera id=\"" << identifier << "\" type=\"perspective\">" << endl;
|
ctx.os << "\t<camera id=\"" << identifier << "\" type=\"perspective\">" << endl;
|
||||||
if (persp->getXfov().cast()) {
|
if (persp->getXfov().cast()) {
|
||||||
Float xFov = (Float) persp->getXfov()->getValue();
|
Float xFov = (Float) persp->getXfov()->getValue();
|
||||||
if (std::abs(xFov-1.0f) < Epsilon && ctx.cvt->m_fov == -1) {
|
|
||||||
SLog(EWarn, "Found the suspicious field of view value \"1.0\", which is likely due to a bug in Blender 2.5"
|
|
||||||
" - setting to 45deg. Please use the \"-f\" parameter to override this.");
|
|
||||||
xFov = 45.0f;
|
|
||||||
}
|
|
||||||
Float yFov = radToDeg(2 * std::atan(std::tan(degToRad(xFov)/2) / aspect));
|
Float yFov = radToDeg(2 * std::atan(std::tan(degToRad(xFov)/2) / aspect));
|
||||||
if (ctx.cvt->m_fov != -1)
|
|
||||||
xFov = yFov = ctx.cvt->m_fov;
|
|
||||||
if (aspect <= 1.0f)
|
if (aspect <= 1.0f)
|
||||||
ctx.os << "\t\t<float name=\"fov\" value=\"" << xFov << "\"/>" << endl;
|
ctx.os << "\t\t<float name=\"fov\" value=\"" << xFov << "\"/>" << endl;
|
||||||
else
|
else
|
||||||
ctx.os << "\t\t<float name=\"fov\" value=\"" << yFov << "\"/>" << endl;
|
ctx.os << "\t\t<float name=\"fov\" value=\"" << yFov << "\"/>" << endl;
|
||||||
} else if (persp->getYfov().cast()) {
|
} else if (persp->getYfov().cast()) {
|
||||||
Float yFov = (Float) persp->getYfov()->getValue();
|
Float yFov = (Float) persp->getYfov()->getValue();
|
||||||
if (std::abs(yFov-1.0) < Epsilon && ctx.cvt->m_fov == -1) {
|
|
||||||
SLog(EWarn, "Found the suspicious field of view value \"1.0\", which is likely due to a bug in Blender 2.5"
|
|
||||||
" - setting to 45deg. Please use the \"-f\" parameter to override this.");
|
|
||||||
yFov = 45.0f;
|
|
||||||
}
|
|
||||||
Float xFov = radToDeg(2 * std::atan(std::tan(degToRad(yFov)/2) * aspect));
|
Float xFov = radToDeg(2 * std::atan(std::tan(degToRad(yFov)/2) * aspect));
|
||||||
if (ctx.cvt->m_fov != -1)
|
|
||||||
xFov = yFov = ctx.cvt->m_fov;
|
|
||||||
if (aspect > 1.0f)
|
if (aspect > 1.0f)
|
||||||
ctx.os << "\t\t<float name=\"fov\" value=\"" << yFov << "\"/>" << endl;
|
ctx.os << "\t\t<float name=\"fov\" value=\"" << yFov << "\"/>" << endl;
|
||||||
else
|
else
|
||||||
|
@ -1178,7 +1164,7 @@ void loadCamera(ColladaContext &ctx, Transform transform, domCamera &camera) {
|
||||||
ctx.os << "\t\t\t<matrix value=\"" << matrixValues.substr(0, matrixValues.length()-1) << "\"/>" << endl;
|
ctx.os << "\t\t\t<matrix value=\"" << matrixValues.substr(0, matrixValues.length()-1) << "\"/>" << endl;
|
||||||
ctx.os << "\t\t</transform>" << endl << endl;
|
ctx.os << "\t\t</transform>" << endl << endl;
|
||||||
ctx.os << "\t\t<sampler id=\"sampler\" type=\"ldsampler\">" << endl;
|
ctx.os << "\t\t<sampler id=\"sampler\" type=\"ldsampler\">" << endl;
|
||||||
ctx.os << "\t\t\t<integer name=\"sampleCount\" value=\"" << ctx.cvt->m_samplesPerPixel << "\"/>" << endl;
|
ctx.os << "\t\t\t<integer name=\"sampleCount\" value=\"4\"/>" << endl;
|
||||||
ctx.os << "\t\t</sampler>" << endl << endl;
|
ctx.os << "\t\t</sampler>" << endl << endl;
|
||||||
ctx.os << "\t\t<film id=\"film\" type=\"" << ctx.cvt->m_filmType << "\">" << endl;
|
ctx.os << "\t\t<film id=\"film\" type=\"" << ctx.cvt->m_filmType << "\">" << endl;
|
||||||
ctx.os << "\t\t\t<integer name=\"width\" value=\"" << xres << "\"/>" << endl;
|
ctx.os << "\t\t\t<integer name=\"width\" value=\"" << xres << "\"/>" << endl;
|
||||||
|
@ -1619,18 +1605,20 @@ void GeometryConverter::convertCollada(const fs::path &inputFile,
|
||||||
ctx.cvt = this;
|
ctx.cvt = this;
|
||||||
ctx.trackIndex = 0;
|
ctx.trackIndex = 0;
|
||||||
|
|
||||||
domLibrary_images_Array &libraryImages = document->getLibrary_images_array();
|
if (m_importMaterials) {
|
||||||
for (size_t i=0; i<libraryImages.getCount(); ++i) {
|
domLibrary_images_Array &libraryImages = document->getLibrary_images_array();
|
||||||
domImage_Array &images = libraryImages[i]->getImage_array();
|
for (size_t i=0; i<libraryImages.getCount(); ++i) {
|
||||||
for (size_t j=0; j<images.getCount(); ++j)
|
domImage_Array &images = libraryImages[i]->getImage_array();
|
||||||
loadImage(ctx, *images.get(j));
|
for (size_t j=0; j<images.getCount(); ++j)
|
||||||
}
|
loadImage(ctx, *images.get(j));
|
||||||
|
}
|
||||||
|
|
||||||
domLibrary_materials_Array &libraryMaterials = document->getLibrary_materials_array();
|
domLibrary_materials_Array &libraryMaterials = document->getLibrary_materials_array();
|
||||||
for (size_t i=0; i<libraryMaterials.getCount(); ++i) {
|
for (size_t i=0; i<libraryMaterials.getCount(); ++i) {
|
||||||
domMaterial_Array &materials = libraryMaterials[i]->getMaterial_array();
|
domMaterial_Array &materials = libraryMaterials[i]->getMaterial_array();
|
||||||
for (size_t j=0; j<materials.getCount(); ++j)
|
for (size_t j=0; j<materials.getCount(); ++j)
|
||||||
loadMaterial(ctx, *materials.get(j));
|
loadMaterial(ctx, *materials.get(j));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
domLibrary_animations_Array &libraryAnimations = document->getLibrary_animations_array();
|
domLibrary_animations_Array &libraryAnimations = document->getLibrary_animations_array();
|
||||||
|
|
|
@ -26,8 +26,6 @@ public:
|
||||||
m_srgb = false;
|
m_srgb = false;
|
||||||
m_mapSmallerSide = true;
|
m_mapSmallerSide = true;
|
||||||
m_xres = m_yres = -1;
|
m_xres = m_yres = -1;
|
||||||
m_samplesPerPixel = 8;
|
|
||||||
m_fov = -1;
|
|
||||||
m_filmType = "exrfilm";
|
m_filmType = "exrfilm";
|
||||||
m_packGeometry = true;
|
m_packGeometry = true;
|
||||||
}
|
}
|
||||||
|
@ -42,9 +40,8 @@ public:
|
||||||
inline void setSRGB(bool srgb) { m_srgb = srgb; }
|
inline void setSRGB(bool srgb) { m_srgb = srgb; }
|
||||||
inline void setMapSmallerSide(bool mapSmallerSide) { m_mapSmallerSide = mapSmallerSide; }
|
inline void setMapSmallerSide(bool mapSmallerSide) { m_mapSmallerSide = mapSmallerSide; }
|
||||||
inline void setResolution(int xres, int yres) { m_xres = xres; m_yres = yres; }
|
inline void setResolution(int xres, int yres) { m_xres = xres; m_yres = yres; }
|
||||||
inline void setSamplesPerPixel(int samplesPerPixel) { m_samplesPerPixel = samplesPerPixel; }
|
|
||||||
inline void setPackGeometry(bool packGeometry) { m_packGeometry = packGeometry; }
|
inline void setPackGeometry(bool packGeometry) { m_packGeometry = packGeometry; }
|
||||||
inline void setFov(Float fov) { m_fov = fov; }
|
inline void setImportMaterials(bool importMaterials) { m_importMaterials = importMaterials; }
|
||||||
inline void setFilmType(const std::string &filmType) { m_filmType = filmType; }
|
inline void setFilmType(const std::string &filmType) { m_filmType = filmType; }
|
||||||
inline const fs::path &getFilename() const { return m_filename; }
|
inline const fs::path &getFilename() const { return m_filename; }
|
||||||
private:
|
private:
|
||||||
|
@ -55,9 +52,8 @@ private:
|
||||||
const fs::path &textureDirectory,
|
const fs::path &textureDirectory,
|
||||||
const fs::path &meshesDirectory);
|
const fs::path &meshesDirectory);
|
||||||
public:
|
public:
|
||||||
bool m_srgb, m_mapSmallerSide;
|
bool m_srgb, m_mapSmallerSide, m_importMaterials;
|
||||||
int m_xres, m_yres, m_samplesPerPixel;
|
int m_xres, m_yres;
|
||||||
Float m_fov;
|
|
||||||
fs::path m_filename, m_outputDirectory;
|
fs::path m_filename, m_outputDirectory;
|
||||||
std::string m_filmType;
|
std::string m_filmType;
|
||||||
ref<FileStream> m_geometryFile;
|
ref<FileStream> m_geometryFile;
|
||||||
|
|
|
@ -54,13 +54,12 @@ void help() {
|
||||||
<< " -h Display this help text" << endl << endl
|
<< " -h Display this help text" << endl << endl
|
||||||
<< " -a p1;p2;.. Add one or more entries to the resource search path" << endl << endl
|
<< " -a p1;p2;.. Add one or more entries to the resource search path" << endl << endl
|
||||||
<< " -v Be more verbose" << endl << endl
|
<< " -v Be more verbose" << endl << endl
|
||||||
<< " -p <num> Use the specified number of samples per pixel." << endl << endl
|
|
||||||
<< " -s Assume that colors are in sRGB space." << endl << endl
|
<< " -s Assume that colors are in sRGB space." << endl << endl
|
||||||
<< " -m Map the larger image side to the full field of view" << endl << endl
|
<< " -m Map the larger image side to the full field of view" << endl << endl
|
||||||
<< " -y Don't pack all geometry data into a single file" << endl << endl
|
<< " -y Don't pack all geometry data into a single file" << endl << endl
|
||||||
|
<< " -n Don't import any materials (an adjustments file will be necessary)" << endl << endl
|
||||||
<< " -l <type> Override the type of film (e.g. 'exrfilm', 'pngfilm', ..)" << endl << endl
|
<< " -l <type> Override the type of film (e.g. 'exrfilm', 'pngfilm', ..)" << endl << endl
|
||||||
<< " -r <w>x<h> Override the image resolution to e.g. 1920x1080" << endl << endl
|
<< " -r <w>x<h> Override the image resolution to e.g. 1920x1080" << endl << endl
|
||||||
<< " -f <fov> Override the field of view to the given value in degrees." << endl << endl
|
|
||||||
<< "Please see the documentation for more information." << endl;
|
<< "Please see the documentation for more information." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,16 +67,15 @@ int colladaMain(int argc, char **argv) {
|
||||||
bool srgb = false, mapSmallerSide = true;
|
bool srgb = false, mapSmallerSide = true;
|
||||||
char optchar, *end_ptr = NULL;
|
char optchar, *end_ptr = NULL;
|
||||||
int xres = -1, yres = -1;
|
int xres = -1, yres = -1;
|
||||||
int samplesPerPixel = 8;
|
|
||||||
std::string filmType = "exrfilm";
|
std::string filmType = "exrfilm";
|
||||||
Float fov = -1;
|
|
||||||
FileResolver *fileResolver = Thread::getThread()->getFileResolver();
|
FileResolver *fileResolver = Thread::getThread()->getFileResolver();
|
||||||
ELogLevel logLevel = EInfo;
|
ELogLevel logLevel = EInfo;
|
||||||
bool packGeometry = true;
|
bool packGeometry = true;
|
||||||
|
bool importMaterials = true;
|
||||||
|
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
|
||||||
while ((optchar = getopt(argc, argv, "svyhmr:a:p:f:l:")) != -1) {
|
while ((optchar = getopt(argc, argv, "snvyhmr:a:l:")) != -1) {
|
||||||
switch (optchar) {
|
switch (optchar) {
|
||||||
case 'a': {
|
case 'a': {
|
||||||
std::vector<std::string> paths = tokenize(optarg, ";");
|
std::vector<std::string> paths = tokenize(optarg, ";");
|
||||||
|
@ -91,10 +89,8 @@ int colladaMain(int argc, char **argv) {
|
||||||
case 'm':
|
case 'm':
|
||||||
mapSmallerSide = false;
|
mapSmallerSide = false;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'n':
|
||||||
samplesPerPixel = strtol(optarg, &end_ptr, 10);
|
importMaterials = false;
|
||||||
if (*end_ptr != '\0')
|
|
||||||
SLog(EError, "Invalid number of samples per pixel!");
|
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
logLevel = EDebug;
|
logLevel = EDebug;
|
||||||
|
@ -105,11 +101,6 @@ int colladaMain(int argc, char **argv) {
|
||||||
case 'y':
|
case 'y':
|
||||||
packGeometry = false;
|
packGeometry = false;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
|
||||||
fov = (Float) strtod(optarg, &end_ptr);
|
|
||||||
if (*end_ptr != '\0')
|
|
||||||
SLog(EError, "Invalid field of view value!");
|
|
||||||
break;
|
|
||||||
case 'r': {
|
case 'r': {
|
||||||
std::vector<std::string> tokens = tokenize(optarg, "x");
|
std::vector<std::string> tokens = tokenize(optarg, "x");
|
||||||
if (tokens.size() != 2)
|
if (tokens.size() != 2)
|
||||||
|
@ -140,9 +131,8 @@ int colladaMain(int argc, char **argv) {
|
||||||
ConsoleGeometryConverter converter;
|
ConsoleGeometryConverter converter;
|
||||||
converter.setSRGB(srgb);
|
converter.setSRGB(srgb);
|
||||||
converter.setResolution(xres, yres);
|
converter.setResolution(xres, yres);
|
||||||
|
converter.setImportMaterials(importMaterials);
|
||||||
converter.setMapSmallerSide(mapSmallerSide);
|
converter.setMapSmallerSide(mapSmallerSide);
|
||||||
converter.setSamplesPerPixel(samplesPerPixel);
|
|
||||||
converter.setFov(fov);
|
|
||||||
converter.setPackGeometry(packGeometry);
|
converter.setPackGeometry(packGeometry);
|
||||||
converter.setFilmType(filmType);
|
converter.setFilmType(filmType);
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ void GeometryConverter::convertOBJ(const fs::path &inputFile,
|
||||||
std::string buf, line;
|
std::string buf, line;
|
||||||
std::set<std::string> mtlList;
|
std::set<std::string> mtlList;
|
||||||
while (is >> buf) {
|
while (is >> buf) {
|
||||||
if (buf == "mtllib") {
|
if (buf == "mtllib" && m_importMaterials) {
|
||||||
std::getline(is, line);
|
std::getline(is, line);
|
||||||
std::string mtlName = trim(line.substr(1, line.length()-1));
|
std::string mtlName = trim(line.substr(1, line.length()-1));
|
||||||
ref<FileResolver> fRes = Thread::getThread()->getFileResolver()->clone();
|
ref<FileResolver> fRes = Thread::getThread()->getFileResolver()->clone();
|
||||||
|
|
|
@ -25,7 +25,7 @@ Camera::Camera(const Properties &props)
|
||||||
: ConfigurableObject(props), m_properties(props) {
|
: ConfigurableObject(props), m_properties(props) {
|
||||||
m_cameraToWorld = props.getTransform("toWorld", Transform());
|
m_cameraToWorld = props.getTransform("toWorld", Transform());
|
||||||
m_shutterOpen = props.getFloat("shutterOpen", 0.0f);
|
m_shutterOpen = props.getFloat("shutterOpen", 0.0f);
|
||||||
m_shutterClose = props.getFloat("shutterClose", 5.0f);
|
m_shutterClose = props.getFloat("shutterClose", 0.0f);
|
||||||
if (m_shutterOpen > m_shutterClose)
|
if (m_shutterOpen > m_shutterClose)
|
||||||
Log(EError, "Shutter opening time must be less than "
|
Log(EError, "Shutter opening time must be less than "
|
||||||
"or equal to the shutter closing time!");
|
"or equal to the shutter closing time!");
|
||||||
|
|
|
@ -68,13 +68,14 @@ void PreviewWorker::processIncoherent(const WorkUnit *workUnit, WorkResult *work
|
||||||
Vector toVPL;
|
Vector toVPL;
|
||||||
Ray primary, secondary;
|
Ray primary, secondary;
|
||||||
int numRays = 0;
|
int numRays = 0;
|
||||||
|
float shutterOpen = m_scene->getCamera()->getShutterOpen();
|
||||||
|
|
||||||
for (int y=sy; y<ey; ++y) {
|
for (int y=sy; y<ey; ++y) {
|
||||||
for (int x=sx; x<ex; ++x) {
|
for (int x=sx; x<ex; ++x) {
|
||||||
/* Generate a camera ray without normalization */
|
/* Generate a camera ray without normalization */
|
||||||
primary = Ray(m_cameraO, m_cameraTL
|
primary = Ray(m_cameraO, m_cameraTL
|
||||||
+ m_cameraDx * (Float) x
|
+ m_cameraDx * (Float) x
|
||||||
+ m_cameraDy * (Float) y, 0.0f);
|
+ m_cameraDy * (Float) y, shutterOpen);
|
||||||
|
|
||||||
++numRays;
|
++numRays;
|
||||||
if (!m_kdtree->rayIntersect(primary, its)) {
|
if (!m_kdtree->rayIntersect(primary, its)) {
|
||||||
|
@ -88,7 +89,7 @@ void PreviewWorker::processIncoherent(const WorkUnit *workUnit, WorkResult *work
|
||||||
value = Spectrum(0.0f);
|
value = Spectrum(0.0f);
|
||||||
|
|
||||||
toVPL = m_vpl.its.p - its.p;
|
toVPL = m_vpl.its.p - its.p;
|
||||||
secondary = Ray(its.p, toVPL, ShadowEpsilon, 1-ShadowEpsilon, 0.0f);
|
secondary = Ray(its.p, toVPL, ShadowEpsilon, 1-ShadowEpsilon, shutterOpen);
|
||||||
++numRays;
|
++numRays;
|
||||||
if (m_kdtree->rayIntersect(secondary)) {
|
if (m_kdtree->rayIntersect(secondary)) {
|
||||||
block->setPixel(pos++, value);
|
block->setPixel(pos++, value);
|
||||||
|
@ -352,6 +353,7 @@ void PreviewWorker::processCoherent(const WorkUnit *workUnit, WorkResult *workRe
|
||||||
);
|
);
|
||||||
its.t = its4.t.f[idx];
|
its.t = its4.t.f[idx];
|
||||||
shape->fillIntersectionRecord(ray, temp + idx * MTS_KD_INTERSECTION_TEMP + 8, its);
|
shape->fillIntersectionRecord(ray, temp + idx * MTS_KD_INTERSECTION_TEMP + 8, its);
|
||||||
|
bsdf = its.shape->getBSDF();
|
||||||
}
|
}
|
||||||
|
|
||||||
wo.x = nSecD[0].f[idx]; wo.y = nSecD[1].f[idx]; wo.z = nSecD[2].f[idx];
|
wo.x = nSecD[0].f[idx]; wo.y = nSecD[1].f[idx]; wo.z = nSecD[2].f[idx];
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include <mitsuba/core/platform.h>
|
#include <mitsuba/core/platform.h>
|
||||||
#include <xercesc/parsers/SAXParser.hpp>
|
#include <xercesc/parsers/SAXParser.hpp>
|
||||||
#include <mitsuba/render/shandler.h>
|
#include <mitsuba/render/scenehandler.h>
|
||||||
#include <mitsuba/core/fresolver.h>
|
#include <mitsuba/core/fresolver.h>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <xercesc/parsers/SAXParser.hpp>
|
#include <xercesc/parsers/SAXParser.hpp>
|
||||||
#include <mitsuba/core/fresolver.h>
|
#include <mitsuba/core/fresolver.h>
|
||||||
#include <mitsuba/render/util.h>
|
#include <mitsuba/render/util.h>
|
||||||
#include <mitsuba/render/shandler.h>
|
#include <mitsuba/render/scenehandler.h>
|
||||||
|
|
||||||
MTS_NAMESPACE_BEGIN
|
MTS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <mitsuba/core/shvector.h>
|
#include <mitsuba/core/shvector.h>
|
||||||
#include <mitsuba/core/statistics.h>
|
#include <mitsuba/core/statistics.h>
|
||||||
#include <mitsuba/render/renderjob.h>
|
#include <mitsuba/render/renderjob.h>
|
||||||
#include <mitsuba/render/shandler.h>
|
#include <mitsuba/render/scenehandler.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <mitsuba/core/appender.h>
|
#include <mitsuba/core/appender.h>
|
||||||
#include <mitsuba/render/util.h>
|
#include <mitsuba/render/util.h>
|
||||||
#include <mitsuba/render/renderjob.h>
|
#include <mitsuba/render/renderjob.h>
|
||||||
#include <mitsuba/render/shandler.h>
|
#include <mitsuba/render/scenehandler.h>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <xercesc/parsers/SAXParser.hpp>
|
#include <xercesc/parsers/SAXParser.hpp>
|
||||||
#include "glwidget.h"
|
#include "glwidget.h"
|
||||||
#include "sceneloader.h"
|
#include "sceneloader.h"
|
||||||
#include <mitsuba/render/shandler.h>
|
#include <mitsuba/render/scenehandler.h>
|
||||||
#include <mitsuba/core/fresolver.h>
|
#include <mitsuba/core/fresolver.h>
|
||||||
#include <mitsuba/core/fstream.h>
|
#include <mitsuba/core/fstream.h>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
: Shape(stream, manager) {
|
: Shape(stream, manager) {
|
||||||
m_shapeGroup = static_cast<ShapeGroup *>(manager->getInstance(stream));
|
m_shapeGroup = static_cast<ShapeGroup *>(manager->getInstance(stream));
|
||||||
m_transform = new AnimatedTransform(stream);
|
m_transform = new AnimatedTransform(stream);
|
||||||
|
configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialize(Stream *stream, InstanceManager *manager) const {
|
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||||
|
@ -134,5 +135,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
MTS_IMPLEMENT_CLASS_S(AnimatedInstance, false, Shape)
|
MTS_IMPLEMENT_CLASS_S(AnimatedInstance, false, Shape)
|
||||||
MTS_EXPORT_PLUGIN(AnimatedInstance, "AnimatedInstanced geometry");
|
MTS_EXPORT_PLUGIN(AnimatedInstance, "Animated instanced geometry");
|
||||||
MTS_NAMESPACE_END
|
MTS_NAMESPACE_END
|
||||||
|
|
|
@ -46,7 +46,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Spectrum getValue(const Point2 &uv) const {
|
inline Spectrum getValue(const Point2 &uv) const {
|
||||||
int x = 2*(((int) (uv.x * 2)) % 2) - 1, y = 2*(((int) (uv.y * 2)) % 2) - 1;
|
int x = 2*modulo((int) (uv.x * 2), 2) - 1,
|
||||||
|
y = 2*modulo((int) (uv.y * 2), 2) - 1;
|
||||||
|
|
||||||
if (x*y == 1)
|
if (x*y == 1)
|
||||||
return m_brightColor;
|
return m_brightColor;
|
||||||
|
|
|
@ -186,7 +186,7 @@ class EXPORT_OT_mitsuba(bpy.types.Operator):
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
[mtsimport_binary, '-r', '%dx%d' % (width, height),
|
[mtsimport_binary, '-r', '%dx%d' % (width, height),
|
||||||
'-l', 'pngfilm', mts_dae_file, mts_xml_file, mts_adj_file],
|
'-n', '-l', 'pngfilm', mts_dae_file, mts_xml_file, mts_adj_file],
|
||||||
env = env,
|
env = env,
|
||||||
cwd = self.properties.directory
|
cwd = self.properties.directory
|
||||||
)
|
)
|
||||||
|
|
|
@ -28,7 +28,6 @@ class MtsFilmDisplay(TimerThread):
|
||||||
|
|
||||||
result = self.LocalStorage['RE'].begin_result(0, 0, int(xres), int(yres))
|
result = self.LocalStorage['RE'].begin_result(0, 0, int(xres), int(yres))
|
||||||
if os.path.exists(self.LocalStorage['output_file']):
|
if os.path.exists(self.LocalStorage['output_file']):
|
||||||
bpy.ops.ef.msg(msg_text='Updating RenderResult')
|
|
||||||
lay = result.layers[0]
|
lay = result.layers[0]
|
||||||
lay.load_from_file(self.LocalStorage['output_file'])
|
lay.load_from_file(self.LocalStorage['output_file'])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -111,7 +111,7 @@ class MATERIAL_PT_preview_mts(MaterialButtonsPanel, bpy.types.Panel):
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not hasattr(context, 'material'):
|
if not hasattr(context, 'material'):
|
||||||
return
|
return
|
||||||
self.layout.template_preview(context.material)
|
self.layout.template_preview(context.material, show_buttons=False)
|
||||||
engine = context.scene.mitsuba_engine
|
engine = context.scene.mitsuba_engine
|
||||||
row = self.layout.row(True)
|
row = self.layout.row(True)
|
||||||
row.prop(engine, "preview_depth")
|
row.prop(engine, "preview_depth")
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
Loading…
Reference in New Issue