forked from bartvdbraak/blender
BGE: Adding support for the Cast Only material option.
Note: This does not add support for the option in the viewport.
This commit is contained in:
parent
9d4b54b44f
commit
e02b9c8a45
@ -611,6 +611,10 @@ static bool ConvertMaterial(
|
||||
|
||||
// cast shadows?
|
||||
material->ras_mode |= ( mat->mode & MA_SHADBUF )?CAST_SHADOW:0;
|
||||
|
||||
// only shadows?
|
||||
material->ras_mode |= ( mat->mode & MA_ONLYCAST )?ONLY_SHADOW:0;
|
||||
|
||||
MTex *mttmp = 0;
|
||||
int valid_index = 0;
|
||||
|
||||
|
@ -144,7 +144,8 @@ enum BL_ras_mode
|
||||
WIRE=64,
|
||||
CAST_SHADOW=128,
|
||||
TEX=256,
|
||||
TWOSIDED=512
|
||||
TWOSIDED=512,
|
||||
ONLY_SHADOW=1024,
|
||||
};
|
||||
|
||||
// -------------------------------------
|
||||
|
@ -110,6 +110,7 @@ void KX_BlenderMaterial::Initialize(
|
||||
m_flag |= ((mMaterial->ras_mode & USE_LIGHT)!=0)? RAS_MULTILIGHT: 0;
|
||||
m_flag |= (mMaterial->glslmat)? RAS_BLENDERGLSL: 0;
|
||||
m_flag |= ((mMaterial->ras_mode & CAST_SHADOW)!=0)? RAS_CASTSHADOW: 0;
|
||||
m_flag |= ((mMaterial->ras_mode & ONLY_SHADOW)!=0)? RAS_ONLYSHADOW: 0;
|
||||
|
||||
// test the sum of the various modes for equality
|
||||
// so we can ether accept or reject this material
|
||||
|
@ -282,6 +282,11 @@ bool RAS_IPolyMaterial::CastsShadows() const
|
||||
return (m_flag & RAS_CASTSHADOW) != 0;
|
||||
}
|
||||
|
||||
bool RAS_IPolyMaterial::OnlyShadow() const
|
||||
{
|
||||
return (m_flag & RAS_ONLYSHADOW) != 0;
|
||||
}
|
||||
|
||||
bool RAS_IPolyMaterial::UsesObjectColor() const
|
||||
{
|
||||
return !(m_flag & RAS_BLENDERGLSL);
|
||||
|
@ -61,7 +61,8 @@ enum MaterialProps
|
||||
RAS_NORMAL =256,
|
||||
RAS_DEFMULTI =512,
|
||||
RAS_BLENDERGLSL =1024,
|
||||
RAS_CASTSHADOW =2048
|
||||
RAS_CASTSHADOW =2048,
|
||||
RAS_ONLYSHADOW =4096,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -174,6 +175,7 @@ public:
|
||||
virtual bool UsesLighting(RAS_IRasterizer *rasty) const;
|
||||
virtual bool UsesObjectColor() const;
|
||||
virtual bool CastsShadows() const;
|
||||
virtual bool OnlyShadow() const;
|
||||
|
||||
virtual void Replace_IScene(SCA_IScene *val) {} /* overridden by KX_BlenderMaterial */
|
||||
|
||||
|
@ -587,6 +587,9 @@ bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_I
|
||||
if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !m_material->CastsShadows())
|
||||
return false;
|
||||
|
||||
if (rasty->GetDrawingMode() != RAS_IRasterizer::KX_SHADOW && m_material->OnlyShadow())
|
||||
return false;
|
||||
|
||||
if (!rasty->SetMaterial(*m_material))
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user