Fix texture render in HdStorm. #54

Merged
Bogdan Nagirniak merged 3 commits from BLEN-357 into hydra-render 2023-06-13 03:19:22 +02:00
2 changed files with 8 additions and 5 deletions

View File

@ -139,7 +139,6 @@ void LightData::update()
pxr::VtValue LightData::get_data(pxr::TfToken const &key) const pxr::VtValue LightData::get_data(pxr::TfToken const &key) const
{ {
ID_LOG(3, "%s", key.GetText()); ID_LOG(3, "%s", key.GetText());
pxr::VtValue ret;
auto it = data_.find(key); auto it = data_.find(key);
if (it != data_.end()) { if (it != data_.end()) {
return pxr::VtValue(it->second); return pxr::VtValue(it->second);

View File

@ -2,6 +2,7 @@
* Copyright 2011-2022 Blender Foundation */ * Copyright 2011-2022 Blender Foundation */
#include <pxr/base/gf/vec2f.h> #include <pxr/base/gf/vec2f.h>
#include <pxr/base/tf/staticTokens.h>
#include <pxr/imaging/hd/tokens.h> #include <pxr/imaging/hd/tokens.h>
#include "BKE_material.h" #include "BKE_material.h"
@ -12,6 +13,10 @@
#include "blender_scene_delegate.h" #include "blender_scene_delegate.h"
#include "mesh.h" #include "mesh.h"
PXR_NAMESPACE_OPEN_SCOPE
TF_DEFINE_PRIVATE_TOKENS(_tokens, (st));
PXR_NAMESPACE_CLOSE_SCOPE
namespace blender::render::hydra { namespace blender::render::hydra {
MeshData::MeshData(BlenderSceneDelegate *scene_delegate, MeshData::MeshData(BlenderSceneDelegate *scene_delegate,
@ -85,7 +90,7 @@ pxr::VtValue MeshData::get_data(pxr::SdfPath const &id, pxr::TfToken const &key)
else if (key == pxr::HdTokens->normals) { else if (key == pxr::HdTokens->normals) {
return pxr::VtValue(submesh(id).normals); return pxr::VtValue(submesh(id).normals);
} }
else if (key == pxr::HdPrimvarRoleTokens->textureCoordinate) { else if (key == pxr::_tokens->st) {
return pxr::VtValue(submesh(id).uvs); return pxr::VtValue(submesh(id).uvs);
} }
return pxr::VtValue(); return pxr::VtValue();
@ -128,9 +133,8 @@ pxr::HdPrimvarDescriptorVector MeshData::primvar_descriptors(
pxr::HdTokens->normals, interpolation, pxr::HdPrimvarRoleTokens->normal); pxr::HdTokens->normals, interpolation, pxr::HdPrimvarRoleTokens->normal);
} }
if (!submeshes_[0].uvs.empty()) { if (!submeshes_[0].uvs.empty()) {
primvars.emplace_back(pxr::HdPrimvarRoleTokens->textureCoordinate, primvars.emplace_back(
interpolation, pxr::_tokens->st, interpolation, pxr::HdPrimvarRoleTokens->textureCoordinate);
pxr::HdPrimvarRoleTokens->textureCoordinate);
} }
} }
return primvars; return primvars;