minor improvements

metadata
Wenzel Jakob 2011-04-10 22:07:08 +02:00
parent b45a27a6cb
commit d612e23971
10 changed files with 50 additions and 8 deletions

View File

@ -302,6 +302,8 @@ class MtsExporter:
ltype = lamp.data.type
name = translate_id(lamp.data.name)
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':
self.openElement('luminaire', { 'type' : 'point', 'id' : '%s-light' % name })
self.exportWorldTrafo(lamp.matrix_world)
@ -309,9 +311,8 @@ class MtsExporter:
"%f %f %f" % (lamp.data.color.r*mult, lamp.data.color.g*mult,
lamp.data.color.b*mult)})
self.parameter('float', 'samplingWeight', {'value' : '%f' % lamp.data.mitsuba_lamp.samplingWeight})
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()
elif ltype == 'AREA':
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', '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})
if lamp.data.mitsuba_lamp.inside_medium:
self.element('ref', {'id' : lamp.data.mitsuba_lamp.lamp_medium})
self.closeElement()
elif ltype == 'HEMI':
if lamp.data.mitsuba_lamp.envmap_type == 'constant':
@ -378,6 +381,7 @@ class MtsExporter:
def exportIntegrator(self, integrator):
self.openElement('integrator', { 'id' : 'integrator', 'type' : integrator.type})
self.parameter('integer', 'maxDepth', { 'value' : str(integrator.maxdepth)})
self.closeElement()
def exportSampler(self, sampler):

View File

@ -32,6 +32,7 @@ class mitsuba_integrator(declarative_property_group):
controls = [
'type',
'maxdepth',
['motionblur',
'shuttertime']
]
@ -50,7 +51,8 @@ class mitsuba_integrator(declarative_property_group):
'items': [
('volpath', 'Volumetric path tracer', 'volpath'),
('path', 'Path tracer', 'path'),
('direct', 'Direct Illumination', 'direct')
('direct', 'Direct Illumination', 'direct'),
('ptracer', 'Adjoint Particle Tracer', 'ptracer')
],
'save_in_preset': True
},
@ -71,6 +73,16 @@ class mitsuba_integrator(declarative_property_group):
'min': 0,
'max': 100,
'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
}
]

View File

@ -76,7 +76,11 @@ protected:
public:
static Class *m_theClass; ///< Pointer to the object's class descriptor
private:
#ifndef WIN32
volatile mutable int m_refCount;
#else
volatile mutable LONG m_refCount;
#endif
};
inline int Object::getRefCount() const {

View File

@ -186,6 +186,13 @@ public:
}
#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)
bool operator<(const StatsCounter &v) const;
private:

View File

@ -78,9 +78,9 @@ public:
for (int k=0; k<3; ++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;
else if (i != j && std::abs(sum) > Epsilon)
else if (i != j && std::abs(sum) > 1e-3f)
return true;
}
}

View File

@ -348,6 +348,9 @@ public:
/// Optional pre-process step before rendering starts
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);
//! @}
// =============================================================

View File

@ -111,6 +111,8 @@
<xsd:group ref="objectGroup"/>
<xsd:element name="texture" type="texture"/>
<xsd:element name="luminaire" type="luminaire"/>
<xsd:element name="medium" type="medium"/>
<xsd:element name="ref" type="reference"/>
</xsd:choice>
</xsd:extension>
</xsd:complexContent>

View File

@ -363,8 +363,8 @@ void ConfigurableObject::serialize(Stream *stream, InstanceManager *manager) con
}
void ConfigurableObject::addChild(const std::string &name, ConfigurableObject *child) {
SLog(EError, "ConfigurableObject::addChild(\"%s\") not implemented in \"%s\"",
name.c_str(), toString().c_str());
SLog(EError, "ConfigurableObject::addChild(\"%s\", %s) not implemented in \"%s\"",
name.c_str(), child->toString().c_str(), toString().c_str());
}
void NetworkedObject::serialize(Stream *stream, InstanceManager *manager) const {

View File

@ -53,6 +53,16 @@ Luminaire::Luminaire(Stream *stream, InstanceManager *manager)
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 {
ConfigurableObject::serialize(stream, manager);
manager->serialize(stream, m_medium.get());

View File

@ -109,7 +109,7 @@ void Shape::addChild(const std::string &name, ConfigurableObject *child) {
"'interiorMedium' or 'exteriorMedium')!");
}
} else {
Log(EError, "Shape: Invalid child node!");
ConfigurableObject::addChild(name, child);
}
}