forked from blender/blender
Fix rendering of Final render for Storm delegate #61
@ -178,7 +178,7 @@ bool BlenderSceneDelegate::GetDoubleSided(pxr::SdfPath const &id)
|
||||
pxr::HdCullStyle BlenderSceneDelegate::GetCullStyle(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
return mesh_data(id)->cull_style;
|
||||
return mesh_data(id)->cull_style(id);
|
||||
}
|
||||
|
||||
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
||||
|
@ -89,6 +89,11 @@ pxr::VtValue MaterialData::get_material_resource() const
|
||||
return material_network_map_;
|
||||
}
|
||||
|
||||
pxr::HdCullStyle MaterialData::cull_style() const
|
||||
{
|
||||
return double_sided ? pxr::HdCullStyle::HdCullStyleNothing : pxr::HdCullStyle::HdCullStyleBack;
|
||||
BogdanNagirniak marked this conversation as resolved
|
||||
}
|
||||
|
||||
void MaterialData::export_mtlx()
|
||||
{
|
||||
/* Call of python function hydra.export_mtlx() */
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pxr/base/tf/hashmap.h"
|
||||
#include <pxr/imaging/hd/enums.h>
|
||||
#include <pxr/usd/sdf/assetPath.h>
|
||||
#include <pxr/usd/sdf/path.h>
|
||||
|
||||
@ -27,6 +27,7 @@ class MaterialData : public IdData {
|
||||
|
||||
pxr::VtValue get_data(pxr::TfToken const &key) const override;
|
||||
pxr::VtValue get_material_resource() const;
|
||||
pxr::HdCullStyle cull_style() const;
|
||||
|
||||
bool double_sided = true;
|
||||
|
||||
|
@ -149,6 +149,15 @@ pxr::SdfPath MeshData::material_id(pxr::SdfPath const &id) const
|
||||
return sm.mat_data->prim_id;
|
||||
}
|
||||
|
||||
pxr::HdCullStyle MeshData::cull_style(pxr::SdfPath const &id) const
|
||||
{
|
||||
const SubMesh &sm = submesh(id);
|
||||
if (sm.mat_data) {
|
||||
return sm.mat_data->cull_style();
|
||||
}
|
||||
return pxr::HdCullStyle::HdCullStyleDontCare;
|
||||
}
|
||||
|
||||
bool MeshData::double_sided(pxr::SdfPath const &id) const
|
||||
{
|
||||
const SubMesh &sm = submesh(id);
|
||||
@ -163,7 +172,8 @@ void MeshData::update_double_sided(MaterialData *mat_data)
|
||||
for (int i = 0; i < submeshes_.size(); ++i) {
|
||||
if (submeshes_[i].mat_data == mat_data) {
|
||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkRprimDirty(
|
||||
submesh_prim_id(i), pxr::HdChangeTracker::DirtyDoubleSided);
|
||||
submesh_prim_id(i),
|
||||
pxr::HdChangeTracker::DirtyDoubleSided | pxr::HdChangeTracker::DirtyCullStyle);
|
||||
ID_LOG(1, "%d", i);
|
||||
}
|
||||
}
|
||||
|
@ -38,13 +38,12 @@ class MeshData : public ObjectData {
|
||||
pxr::HdMeshTopology mesh_topology(pxr::SdfPath const &id) const;
|
||||
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
|
||||
pxr::SdfPath material_id(pxr::SdfPath const &id) const;
|
||||
pxr::HdCullStyle cull_style(pxr::SdfPath const &id) const;
|
||||
bool double_sided(pxr::SdfPath const &id) const;
|
||||
void update_double_sided(MaterialData *mat_data);
|
||||
void available_materials(Set<pxr::SdfPath> &paths) const;
|
||||
pxr::SdfPathVector submesh_paths() const;
|
||||
|
||||
pxr::HdCullStyle cull_style = pxr::HdCullStyleBack;
|
||||
|
||||
private:
|
||||
pxr::SdfPath submesh_prim_id(int index) const;
|
||||
const SubMesh &submesh(pxr::SdfPath const &id) const;
|
||||
|
@ -176,11 +176,8 @@ void WorldData::write_transform()
|
||||
{
|
||||
transform = pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -90), pxr::GfVec3d());
|
||||
|
||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -180),
|
||||
pxr::GfVec3d());
|
||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, 1.0), 90.0),
|
||||
pxr::GfVec3d());
|
||||
|
||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -180), pxr::GfVec3d());
|
||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, 1.0), 90.0), pxr::GfVec3d());
|
||||
}
|
||||
|
||||
} // namespace blender::render::hydra
|
||||
|
Loading…
Reference in New Issue
Block a user
Check please value with
mesh::cull_style()