#3947 HoloLens : Add face culling to VdeExportPart

This commit is contained in:
Magne Sjaastad 2019-01-15 11:31:47 +01:00
parent 5222950476
commit 5014c86a3f
3 changed files with 46 additions and 1 deletions

View File

@ -44,8 +44,9 @@
#include "cvfPart.h"
#include "cvfRenderState.h"
#include "cvfRenderStateTextureBindings.h"
#include "cvfRenderState_FF.h"
#include "cvfRenderStateCullFace.h"
#include "cvfRenderStateTextureBindings.h"
#include "cvfTexture.h"
#include "cvfTexture2D_FF.h"
@ -131,6 +132,23 @@ std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport(const RimGridVi
}
}
if (visiblePart->effect())
{
const cvf::RenderStateCullFace* renderStateCullFace = dynamic_cast<const cvf::RenderStateCullFace*>(
visiblePart->effect()->renderStateOfType(cvf::RenderState::CULL_FACE));
if (renderStateCullFace)
{
if (renderStateCullFace->mode() == cvf::RenderStateCullFace::BACK)
{
exportPart.setCullFace(VdeExportPart::CF_BACK);
}
else if (renderStateCullFace->mode() == cvf::RenderStateCullFace::FRONT)
{
exportPart.setCullFace(VdeExportPart::CF_FRONT);
}
}
}
appendTextureImage(exportPart, visiblePart.p());
exportParts.push_back(exportPart);

View File

@ -28,6 +28,7 @@ VdeExportPart::VdeExportPart(cvf::Part* part)
, m_color(cvf::Color3f::MAGENTA)
, m_opacity(1.0)
, m_winding(COUNTERCLOCKWISE)
, m_cullFace(CF_NONE)
, m_role(GEOMETRY)
{
}
@ -88,6 +89,14 @@ void VdeExportPart::setWinding(Winding winding)
m_winding = winding;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void VdeExportPart::setCullFace(CullFace cullFace)
{
m_cullFace = cullFace;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -160,6 +169,14 @@ VdeExportPart::Winding VdeExportPart::winding() const
return m_winding;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
VdeExportPart::CullFace VdeExportPart::cullFace() const
{
return m_cullFace;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -44,6 +44,13 @@ public:
COUNTERCLOCKWISE
};
enum CullFace
{
CF_NONE,
CF_FRONT,
CF_BACK
};
enum Role
{
GEOMETRY,
@ -60,6 +67,7 @@ public:
void setColor(const cvf::Color3f& color);
void setOpacity(float opacity);
void setWinding(Winding winding);
void setCullFace(CullFace cullFace);
void setRole(Role role);
const cvf::Part* part() const;
@ -71,6 +79,7 @@ public:
cvf::Color3f color() const;
float opacity() const;
Winding winding() const;
CullFace cullFace() const;
Role role() const;
private:
@ -83,5 +92,6 @@ private:
cvf::Color3f m_color;
float m_opacity;
Winding m_winding;
CullFace m_cullFace;
Role m_role;
};