forked from blender/blender
Need to do the same light power as Cycles in Watts for Hydra RPR #34
@ -30,23 +30,24 @@ void LightData::init()
|
|||||||
|
|
||||||
float intensity = light->energy;
|
float intensity = light->energy;
|
||||||
if (scene_delegate_->engine_type == BlenderSceneDelegate::EngineType::PREVIEW) {
|
if (scene_delegate_->engine_type == BlenderSceneDelegate::EngineType::PREVIEW) {
|
||||||
intensity *= 0.001;
|
intensity *= 0.001f;
|
||||||
}
|
}
|
||||||
data_[pxr::HdLightTokens->intensity] = intensity;
|
//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] = light->area_size / 2;
|
data_[pxr::HdLightTokens->radius] = light->radius;
|
||||||
|
data_[pxr::HdLightTokens->normalize] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LA_SUN:
|
case LA_SUN:
|
||||||
data_[pxr::HdLightTokens->angle] = light->sun_angle * 180.0 / M_PI;
|
data_[pxr::HdLightTokens->angle] = light->sun_angle * 180.0f / float(M_PI);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LA_SPOT:
|
case LA_SPOT:
|
||||||
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = (float)(light->spotsize / 2.0f * 180.0f / M_PI);
|
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = light->spotsize / 2.0f * 180.0f / float(M_PI);
|
||||||
data_[pxr::UsdLuxTokens->inputsShapingConeSoftness] = light->spotblend;
|
data_[pxr::UsdLuxTokens->inputsShapingConeSoftness] = light->spotblend;
|
||||||
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
||||||
break;
|
break;
|
||||||
@ -63,11 +64,13 @@ void LightData::init()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LA_AREA_DISK:
|
case LA_AREA_DISK:
|
||||||
data_[pxr::HdLightTokens->radius] = light->area_size / 2;
|
data_[pxr::HdLightTokens->radius] = light->area_size / 2.0f;
|
||||||
|
intensity /= 2.0f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LA_AREA_ELLIPSE:
|
case LA_AREA_ELLIPSE:
|
||||||
data_[pxr::HdLightTokens->radius] = (light->area_size + light->area_sizey) / 4;
|
data_[pxr::HdLightTokens->radius] = (light->area_size + light->area_sizey) / 4.0f;
|
||||||
|
intensity /= 2.0f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -80,6 +83,8 @@ void LightData::init()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data_[pxr::HdLightTokens->intensity] = intensity;
|
||||||
|
|
||||||
prim_type_ = prim_type(light);
|
prim_type_ = prim_type(light);
|
||||||
|
|
||||||
/* TODO: temporary value, it should be delivered through Python UI */
|
/* TODO: temporary value, it should be delivered through Python UI */
|
||||||
@ -146,6 +151,7 @@ pxr::VtValue LightData::get_data(pxr::TfToken const &key) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << key.GetString() << " " << ret << " " << ret.IsHolding<float>() << "\n";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user