Implement Viewport render with material preview #56

Merged
Bogdan Nagirniak merged 22 commits from BLEN-421 into hydra-render 2023-06-30 09:03:28 +02:00
Showing only changes of commit e2780854be - Show all commits

View File

@ -102,23 +102,22 @@ void WorldData::init()
}
}
}
else if (LOOK_DEV_STUDIO_LIGHT_ENABLED(scene_delegate_->view3d)) {
StudioLight *sl = BKE_studiolight_find(scene_delegate_->view3d->shading.lookdev_light,
STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE);
if (sl == NULL || (sl->flag & STUDIOLIGHT_TYPE_WORLD) == 0) {
return;
}
data_[pxr::HdLightTokens->textureFile] = pxr::SdfAssetPath(sl->filepath, sl->filepath);
/* coefficient to follow Cycles result */
data_[pxr::HdLightTokens->intensity] = scene_delegate_->view3d->shading.studiolight_intensity / 2;
transform *= pxr::GfMatrix4d(
pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, -1.0),
RAD2DEGF(scene_delegate_->view3d->shading.studiolight_rot_z)),
pxr::GfVec3d());
}
else {
data_[pxr::HdLightTokens->intensity] = 1.0f;
float intensity = 1.0f;
if (LOOK_DEV_STUDIO_LIGHT_ENABLED(scene_delegate_->view3d)) {
StudioLight *sl = BKE_studiolight_find(scene_delegate_->view3d->shading.lookdev_light,
STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE);
if (sl != NULL && sl->flag & STUDIOLIGHT_TYPE_WORLD) {
data_[pxr::HdLightTokens->textureFile] = pxr::SdfAssetPath(sl->filepath, sl->filepath);
transform *= pxr::GfMatrix4d(
pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, -1.0),
RAD2DEGF(scene_delegate_->view3d->shading.studiolight_rot_z)),
pxr::GfVec3d());
/* coefficient to follow Cycles result */
intensity = scene_delegate_->view3d->shading.studiolight_intensity / 2;
}
}
data_[pxr::HdLightTokens->intensity] = intensity;
BogdanNagirniak marked this conversation as resolved Outdated

thif if can be removed

thif `if` can be removed
data_[pxr::HdLightTokens->exposure] = world->exposure;
data_[pxr::HdLightTokens->color] = pxr::GfVec3f(world->horr, world->horg, world->horb);
}