| 446 | bool ModelView::MouseScrollUpdate(double xoffset, double yoffset) |
| 447 | { |
| 448 | m_camera->MouseScrollUpdate(xoffset, yoffset); |
| 449 | return true; |
| 450 | } |
| 451 | |
| 452 | void ModelView::SetTexture(nvrhi::ITexture* texture, bool isSRGB, int slot, bool right) |
| 453 | { |
| 454 | if (slot < 0 || slot >= int(c_MaxTextures)) |
| 455 | { |
| 456 | assert(false); |
| 457 | return; |
| 458 | } |
| 459 | |
| 460 | nvrhi::Format viewFormat = texture->getDesc().format; |
| 461 | m_convertFromSRGB[slot] = false; |
| 462 | if (isSRGB) |
| 463 | { |
| 464 | if (viewFormat == nvrhi::Format::RGBA8_UNORM) |
| 465 | viewFormat = nvrhi::Format::SRGBA8_UNORM; |
| 466 | else |
| 467 | m_convertFromSRGB[slot] = true; |
| 468 | } |
| 469 | |
| 470 | uint32_t page = right ? c_MaxTextures : 0; |
| 471 | auto bindingSetItem = nvrhi::BindingSetItem::Texture_SRV(uint32_t(slot) + page, texture, viewFormat); |
| 472 | if (m_descriptors[bindingSetItem.slot] != bindingSetItem) |
| 473 | { |
| 474 | m_descriptorsValid = false; |
| 475 | m_descriptors[bindingSetItem.slot] = bindingSetItem; |
| 476 | } |