forked from blender/blender
BLEN-365: Improve creation algorithm of PreviewEngine #21
@ -80,15 +80,17 @@ void LightData::init()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p_type = light->type;
|
||||||
|
p_shape = light->area_shape;
|
||||||
|
|
||||||
/* TODO: temporary value, it should be delivered through Python UI */
|
/* TODO: temporary value, it should be delivered through Python UI */
|
||||||
data[pxr::HdLightTokens->exposure] = 1.0f;
|
data[pxr::HdLightTokens->exposure] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::TfToken LightData::prim_type()
|
pxr::TfToken LightData::prim_type()
|
||||||
{
|
{
|
||||||
Light *light = (Light *)((Object *)id)->data;
|
|
||||||
pxr::TfToken ret;
|
pxr::TfToken ret;
|
||||||
switch (light->type) {
|
switch (p_type) {
|
||||||
case LA_LOCAL:
|
case LA_LOCAL:
|
||||||
case LA_SPOT:
|
case LA_SPOT:
|
||||||
ret = pxr::HdPrimTypeTokens->sphereLight;
|
ret = pxr::HdPrimTypeTokens->sphereLight;
|
||||||
@ -99,7 +101,7 @@ pxr::TfToken LightData::prim_type()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LA_AREA:
|
case LA_AREA:
|
||||||
switch (light->area_shape) {
|
switch (p_shape) {
|
||||||
case LA_AREA_SQUARE:
|
case LA_AREA_SQUARE:
|
||||||
case LA_AREA_RECT:
|
case LA_AREA_RECT:
|
||||||
ret = pxr::HdPrimTypeTokens->rectLight;
|
ret = pxr::HdPrimTypeTokens->rectLight;
|
||||||
@ -166,10 +168,16 @@ void LightData::remove()
|
|||||||
|
|
||||||
void LightData::update()
|
void LightData::update()
|
||||||
{
|
{
|
||||||
/* TODO: prim_type was changed we have to do remove..add light */
|
|
||||||
|
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id->name);
|
CLOG_INFO(LOG_BSD, 2, "%s", id->name);
|
||||||
|
|
||||||
|
Light *light = (Light *)((Object *)id)->data;
|
||||||
|
if (light->type != p_type || light->area_shape != p_shape) {
|
||||||
|
remove();
|
||||||
|
init();
|
||||||
|
insert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pxr::HdDirtyBits bits = pxr::HdLight::Clean;
|
pxr::HdDirtyBits bits = pxr::HdLight::Clean;
|
||||||
if (id->recalc & ID_RECALC_GEOMETRY) {
|
if (id->recalc & ID_RECALC_GEOMETRY) {
|
||||||
init();
|
init();
|
||||||
|
@ -24,6 +24,8 @@ class LightData : public ObjectData {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<pxr::TfToken, pxr::VtValue> data;
|
std::map<pxr::TfToken, pxr::VtValue> data;
|
||||||
|
short p_type;
|
||||||
|
short p_shape;
|
||||||
DagerD marked this conversation as resolved
Outdated
|
|||||||
pxr::TfToken prim_type();
|
pxr::TfToken prim_type();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user
pxr::TfToken p_type;
make prim_type() with
Light *
parameter