Add per-viewport cull style option
Exposes UsdImagingGLCullStyle as a Cull Style sub-menu in the gear popup (Back Unless Double-Sided / Back / Front / Nothing / No Opinion). Defaults to BackUnlessDoubleSided, matching usdview. Setting persists per-viewport to viewport_settings.ini. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -174,6 +174,7 @@ UsdSceneRenderer::UsdSceneRenderer()
|
||||
, m_aaEnabled(false)
|
||||
, m_backgroundColor(0.15f, 0.15f, 0.15f)
|
||||
, m_shadingMode(ShadingMode::SmoothShaded)
|
||||
, m_cullStyle(CullStyle::BackUnlessDoubleSided)
|
||||
, m_colorCorrectionMode(ColorCorrectionMode::sRGB)
|
||||
, m_ambientLightOnly(true)
|
||||
, m_domeLightEnabled(false)
|
||||
@@ -728,7 +729,7 @@ void UsdSceneRenderer::Render(int width, int height)
|
||||
m_renderParams.showRender = m_showRender;
|
||||
m_renderParams.enableSampleAlphaToCoverage = true;
|
||||
m_renderParams.gammaCorrectColors = false;
|
||||
m_renderParams.cullStyle = pxr::UsdImagingGLCullStyle::CULL_STYLE_BACK_UNLESS_DOUBLE_SIDED;
|
||||
m_renderParams.cullStyle = static_cast<pxr::UsdImagingGLCullStyle>(m_cullStyle);
|
||||
m_renderParams.enableSceneMaterials = true;
|
||||
m_renderParams.enableSceneLights = true;
|
||||
m_renderParams.highlight = true;
|
||||
|
||||
@@ -43,6 +43,15 @@ enum class ShadingMode {
|
||||
Unlit, ///< Smooth geometry, lighting disabled
|
||||
};
|
||||
|
||||
/// Back-face culling style — maps directly to UsdImagingGLCullStyle.
|
||||
enum class CullStyle {
|
||||
NoOpinion = 0,
|
||||
Nothing = 1,
|
||||
Back = 2,
|
||||
Front = 3,
|
||||
BackUnlessDoubleSided = 4,
|
||||
};
|
||||
|
||||
/// Viewport color correction mode — maps to UsdImagingGLRenderParams::colorCorrectionMode.
|
||||
enum class ColorCorrectionMode {
|
||||
Disabled, ///< No correction (raw linear output)
|
||||
@@ -240,6 +249,9 @@ public:
|
||||
ShadingMode GetShadingMode() const { return m_shadingMode; }
|
||||
void SetShadingMode(ShadingMode m) { m_shadingMode = m; m_forceRefresh = true; }
|
||||
|
||||
CullStyle GetCullStyle() const { return m_cullStyle; }
|
||||
void SetCullStyle(CullStyle c) { m_cullStyle = c; m_forceRefresh = true; }
|
||||
|
||||
ColorCorrectionMode GetColorCorrectionMode() const { return m_colorCorrectionMode; }
|
||||
void SetColorCorrectionMode(ColorCorrectionMode m) { m_colorCorrectionMode = m; m_forceRefresh = true; }
|
||||
|
||||
@@ -358,6 +370,7 @@ private:
|
||||
|
||||
// Lighting settings (mirrors stageView.py viewSettings)
|
||||
ShadingMode m_shadingMode; // draw mode + lighting flags
|
||||
CullStyle m_cullStyle; // back/front/none face culling
|
||||
ColorCorrectionMode m_colorCorrectionMode; // viewport color correction
|
||||
std::string m_ocioDisplay;
|
||||
std::string m_ocioView;
|
||||
|
||||
Reference in New Issue
Block a user