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
Showing only changes of commit 78a86b4769 - Show all commits

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,
@ -93,7 +98,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) {
ret = submesh(id).normals; ret = submesh(id).normals;
} }
else if (key == pxr::HdPrimvarRoleTokens->textureCoordinate) { else if (key == pxr::_tokens->st) { // pxr::HdPrimvarRoleTokens->textureCoordinate) {
ret = submesh(id).uvs; ret = submesh(id).uvs;
} }
return ret; return ret;
@ -136,9 +141,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;