minor improvements
parent
b45a27a6cb
commit
d612e23971
|
@ -302,6 +302,8 @@ class MtsExporter:
|
||||||
ltype = lamp.data.type
|
ltype = lamp.data.type
|
||||||
name = translate_id(lamp.data.name)
|
name = translate_id(lamp.data.name)
|
||||||
mult = lamp.data.mitsuba_lamp.intensity
|
mult = lamp.data.mitsuba_lamp.intensity
|
||||||
|
if lamp.data.mitsuba_lamp.inside_medium:
|
||||||
|
self.exportMedium(scene.mitsuba_media.media[lamp.data.mitsuba_lamp.lamp_medium])
|
||||||
if ltype == 'POINT':
|
if ltype == 'POINT':
|
||||||
self.openElement('luminaire', { 'type' : 'point', 'id' : '%s-light' % name })
|
self.openElement('luminaire', { 'type' : 'point', 'id' : '%s-light' % name })
|
||||||
self.exportWorldTrafo(lamp.matrix_world)
|
self.exportWorldTrafo(lamp.matrix_world)
|
||||||
|
@ -309,9 +311,8 @@ class MtsExporter:
|
||||||
"%f %f %f" % (lamp.data.color.r*mult, lamp.data.color.g*mult,
|
"%f %f %f" % (lamp.data.color.r*mult, lamp.data.color.g*mult,
|
||||||
lamp.data.color.b*mult)})
|
lamp.data.color.b*mult)})
|
||||||
self.parameter('float', 'samplingWeight', {'value' : '%f' % lamp.data.mitsuba_lamp.samplingWeight})
|
self.parameter('float', 'samplingWeight', {'value' : '%f' % lamp.data.mitsuba_lamp.samplingWeight})
|
||||||
|
|
||||||
if lamp.data.mitsuba_lamp.inside_medium:
|
if lamp.data.mitsuba_lamp.inside_medium:
|
||||||
self.exportMediumReference(scene, lamp, None, lamp.data.mitsuba_lamp.lamp_medium)
|
self.element('ref', {'id' : lamp.data.mitsuba_lamp.lamp_medium})
|
||||||
self.closeElement()
|
self.closeElement()
|
||||||
elif ltype == 'AREA':
|
elif ltype == 'AREA':
|
||||||
self.element('remove', { 'id' : '%s-light' % name})
|
self.element('remove', { 'id' : '%s-light' % name})
|
||||||
|
@ -360,6 +361,8 @@ class MtsExporter:
|
||||||
self.parameter('float', 'cutoffAngle', {'value' : '%f' % (lamp.data.spot_size * 180 / (math.pi * 2))})
|
self.parameter('float', 'cutoffAngle', {'value' : '%f' % (lamp.data.spot_size * 180 / (math.pi * 2))})
|
||||||
self.parameter('float', 'beamWidth', {'value' : '%f' % (lamp.data.spot_blend * lamp.data.spot_size * 180 / (math.pi * 2))})
|
self.parameter('float', 'beamWidth', {'value' : '%f' % (lamp.data.spot_blend * lamp.data.spot_size * 180 / (math.pi * 2))})
|
||||||
self.parameter('float', 'samplingWeight', {'value' : '%f' % lamp.data.mitsuba_lamp.samplingWeight})
|
self.parameter('float', 'samplingWeight', {'value' : '%f' % lamp.data.mitsuba_lamp.samplingWeight})
|
||||||
|
if lamp.data.mitsuba_lamp.inside_medium:
|
||||||
|
self.element('ref', {'id' : lamp.data.mitsuba_lamp.lamp_medium})
|
||||||
self.closeElement()
|
self.closeElement()
|
||||||
elif ltype == 'HEMI':
|
elif ltype == 'HEMI':
|
||||||
if lamp.data.mitsuba_lamp.envmap_type == 'constant':
|
if lamp.data.mitsuba_lamp.envmap_type == 'constant':
|
||||||
|
@ -378,6 +381,7 @@ class MtsExporter:
|
||||||
|
|
||||||
def exportIntegrator(self, integrator):
|
def exportIntegrator(self, integrator):
|
||||||
self.openElement('integrator', { 'id' : 'integrator', 'type' : integrator.type})
|
self.openElement('integrator', { 'id' : 'integrator', 'type' : integrator.type})
|
||||||
|
self.parameter('integer', 'maxDepth', { 'value' : str(integrator.maxdepth)})
|
||||||
self.closeElement()
|
self.closeElement()
|
||||||
|
|
||||||
def exportSampler(self, sampler):
|
def exportSampler(self, sampler):
|
||||||
|
|
|
@ -32,6 +32,7 @@ class mitsuba_integrator(declarative_property_group):
|
||||||
|
|
||||||
controls = [
|
controls = [
|
||||||
'type',
|
'type',
|
||||||
|
'maxdepth',
|
||||||
['motionblur',
|
['motionblur',
|
||||||
'shuttertime']
|
'shuttertime']
|
||||||
]
|
]
|
||||||
|
@ -50,7 +51,8 @@ class mitsuba_integrator(declarative_property_group):
|
||||||
'items': [
|
'items': [
|
||||||
('volpath', 'Volumetric path tracer', 'volpath'),
|
('volpath', 'Volumetric path tracer', 'volpath'),
|
||||||
('path', 'Path tracer', 'path'),
|
('path', 'Path tracer', 'path'),
|
||||||
('direct', 'Direct Illumination', 'direct')
|
('direct', 'Direct Illumination', 'direct'),
|
||||||
|
('ptracer', 'Adjoint Particle Tracer', 'ptracer')
|
||||||
],
|
],
|
||||||
'save_in_preset': True
|
'save_in_preset': True
|
||||||
},
|
},
|
||||||
|
@ -71,6 +73,16 @@ class mitsuba_integrator(declarative_property_group):
|
||||||
'min': 0,
|
'min': 0,
|
||||||
'max': 100,
|
'max': 100,
|
||||||
'default': 1
|
'default': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'type': 'int',
|
||||||
|
'attr': 'maxdepth',
|
||||||
|
'name': 'Max. path depth',
|
||||||
|
'description': 'Maximum path depth to be rendered. 2 corresponds to direct illumination, 3 is 1-bounce indirect illumination, etc.',
|
||||||
|
'save_in_preset': True,
|
||||||
|
'min': 2,
|
||||||
|
'max': 100,
|
||||||
|
'default': 4
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,11 @@ protected:
|
||||||
public:
|
public:
|
||||||
static Class *m_theClass; ///< Pointer to the object's class descriptor
|
static Class *m_theClass; ///< Pointer to the object's class descriptor
|
||||||
private:
|
private:
|
||||||
|
#ifndef WIN32
|
||||||
volatile mutable int m_refCount;
|
volatile mutable int m_refCount;
|
||||||
|
#else
|
||||||
|
volatile mutable LONG m_refCount;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int Object::getRefCount() const {
|
inline int Object::getRefCount() const {
|
||||||
|
|
|
@ -186,6 +186,13 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// Reset the stored counter values
|
||||||
|
inline void reset() {
|
||||||
|
for (int i=0; i<NUM_COUNTERS; ++i) {
|
||||||
|
m_value[i].value = m_base[i].value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Sorting by name (for the statistics)
|
/// Sorting by name (for the statistics)
|
||||||
bool operator<(const StatsCounter &v) const;
|
bool operator<(const StatsCounter &v) const;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -78,9 +78,9 @@ public:
|
||||||
for (int k=0; k<3; ++k)
|
for (int k=0; k<3; ++k)
|
||||||
sum += m_transform.m[i][k] * m_transform.m[j][k];
|
sum += m_transform.m[i][k] * m_transform.m[j][k];
|
||||||
|
|
||||||
if (i == j && std::abs(sum-1) > Epsilon)
|
if (i == j && std::abs(sum-1) > 1e-3f)
|
||||||
return true;
|
return true;
|
||||||
else if (i != j && std::abs(sum) > Epsilon)
|
else if (i != j && std::abs(sum) > 1e-3f)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,6 +348,9 @@ public:
|
||||||
/// Optional pre-process step before rendering starts
|
/// Optional pre-process step before rendering starts
|
||||||
virtual void preprocess(const Scene *scene);
|
virtual void preprocess(const Scene *scene);
|
||||||
|
|
||||||
|
/// Add a child (e.g. a medium reference) to this luminaire
|
||||||
|
void addChild(const std::string &name, ConfigurableObject *child);
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
// =============================================================
|
// =============================================================
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,8 @@
|
||||||
<xsd:group ref="objectGroup"/>
|
<xsd:group ref="objectGroup"/>
|
||||||
<xsd:element name="texture" type="texture"/>
|
<xsd:element name="texture" type="texture"/>
|
||||||
<xsd:element name="luminaire" type="luminaire"/>
|
<xsd:element name="luminaire" type="luminaire"/>
|
||||||
|
<xsd:element name="medium" type="medium"/>
|
||||||
|
<xsd:element name="ref" type="reference"/>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
</xsd:extension>
|
</xsd:extension>
|
||||||
</xsd:complexContent>
|
</xsd:complexContent>
|
||||||
|
|
|
@ -363,8 +363,8 @@ void ConfigurableObject::serialize(Stream *stream, InstanceManager *manager) con
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigurableObject::addChild(const std::string &name, ConfigurableObject *child) {
|
void ConfigurableObject::addChild(const std::string &name, ConfigurableObject *child) {
|
||||||
SLog(EError, "ConfigurableObject::addChild(\"%s\") not implemented in \"%s\"",
|
SLog(EError, "ConfigurableObject::addChild(\"%s\", %s) not implemented in \"%s\"",
|
||||||
name.c_str(), toString().c_str());
|
name.c_str(), child->toString().c_str(), toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkedObject::serialize(Stream *stream, InstanceManager *manager) const {
|
void NetworkedObject::serialize(Stream *stream, InstanceManager *manager) const {
|
||||||
|
|
|
@ -53,6 +53,16 @@ Luminaire::Luminaire(Stream *stream, InstanceManager *manager)
|
||||||
Luminaire::~Luminaire() {
|
Luminaire::~Luminaire() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Luminaire::addChild(const std::string &name, ConfigurableObject *child) {
|
||||||
|
const Class *cClass = child->getClass();
|
||||||
|
if (cClass->derivesFrom(MTS_CLASS(Medium))) {
|
||||||
|
Assert(m_medium == NULL);
|
||||||
|
m_medium = static_cast<Medium *>(child);
|
||||||
|
} else {
|
||||||
|
ConfigurableObject::addChild(name, child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Luminaire::serialize(Stream *stream, InstanceManager *manager) const {
|
void Luminaire::serialize(Stream *stream, InstanceManager *manager) const {
|
||||||
ConfigurableObject::serialize(stream, manager);
|
ConfigurableObject::serialize(stream, manager);
|
||||||
manager->serialize(stream, m_medium.get());
|
manager->serialize(stream, m_medium.get());
|
||||||
|
|
|
@ -109,7 +109,7 @@ void Shape::addChild(const std::string &name, ConfigurableObject *child) {
|
||||||
"'interiorMedium' or 'exteriorMedium')!");
|
"'interiorMedium' or 'exteriorMedium')!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log(EError, "Shape: Invalid child node!");
|
ConfigurableObject::addChild(name, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue