forked from blender/blender
Need to do the same light power as Cycles in Watts for Hydra RPR #34
@ -25,20 +25,23 @@ void LightData::init()
|
|||||||
{
|
{
|
||||||
ID_LOG(2, "");
|
ID_LOG(2, "");
|
||||||
|
|
||||||
|
const float round_tolerance = 0.00001f;
|
||||||
|
|
||||||
Light *light = (Light *)((Object *)id)->data;
|
Light *light = (Light *)((Object *)id)->data;
|
||||||
data_.clear();
|
data_.clear();
|
||||||
|
|
||||||
float intensity = light->energy;
|
float intensity = light->energy;
|
||||||
if (scene_delegate_->engine_type == BlenderSceneDelegate::EngineType::PREVIEW) {
|
|
||||||
intensity *= 0.001f;
|
|
||||||
}
|
|
||||||
|
|
||||||
data_[pxr::HdLightTokens->color] = pxr::GfVec3f(light->r, light->g, light->b);
|
data_[pxr::HdLightTokens->color] = pxr::GfVec3f(light->r, light->g, light->b);
|
||||||
|
|
||||||
switch (light->type) {
|
switch (light->type) {
|
||||||
case LA_LOCAL:
|
case LA_LOCAL:
|
||||||
data_[pxr::HdLightTokens->radius] = std::max(light->radius, 0.000001f);
|
if (light->radius > round_tolerance) {
|
||||||
|
data_[pxr::HdLightTokens->radius] = light->radius;
|
||||||
data_[pxr::HdLightTokens->normalize] = true;
|
data_[pxr::HdLightTokens->normalize] = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
||||||
|
}
|
||||||
intensity /= 40.0f;
|
intensity /= 40.0f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -88,12 +91,10 @@ void LightData::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
data_[pxr::HdLightTokens->intensity] = intensity;
|
data_[pxr::HdLightTokens->intensity] = intensity;
|
||||||
|
data_[pxr::HdLightTokens->exposure] = 0.0f;
|
||||||
|
|
||||||
prim_type_ = prim_type(light);
|
prim_type_ = prim_type(light);
|
||||||
|
|
||||||
/* TODO: temporary value, it should be delivered through Python UI */
|
|
||||||
data_[pxr::HdLightTokens->exposure] = 0.0f;
|
|
||||||
|
|
||||||
write_transform();
|
write_transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ void LightData::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
pxr::HdDirtyBits bits = pxr::HdLight::Clean;
|
pxr::HdDirtyBits bits = pxr::HdLight::Clean;
|
||||||
if (id->recalc & ID_RECALC_GEOMETRY) {
|
if (id->recalc & ID_RECALC_GEOMETRY || light->id.recalc & ID_RECALC_GEOMETRY) {
|
||||||
init();
|
init();
|
||||||
bits = pxr::HdLight::AllDirty;
|
bits = pxr::HdLight::AllDirty;
|
||||||
}
|
}
|
||||||
@ -130,10 +131,6 @@ void LightData::update()
|
|||||||
write_transform();
|
write_transform();
|
||||||
bits = pxr::HdLight::DirtyTransform;
|
bits = pxr::HdLight::DirtyTransform;
|
||||||
}
|
}
|
||||||
else if (id->recalc & ID_RECALC_COPY_ON_WRITE) {
|
|
||||||
init();
|
|
||||||
bits = pxr::HdLight::AllDirty;
|
|
||||||
}
|
|
||||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(prim_id, bits);
|
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(prim_id, bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user