Ticket #1771: no_preview_shadows_08172013.patch
File no_preview_shadows_08172013.patch, 5.3 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/shaders/arb/terrain_common.fp
36 36 37 37 // Compute color = texture * (ambient + diffuse*shadow) 38 38 // (diffuse is 2*fragment.color due to clamp-avoidance in the vertex program) 39 #if USE_SHADOW 39 #if USE_SHADOW && !DISABLE_RECEIVE_SHADOWS 40 40 TEMP shadowBias; 41 41 TEMP biasedShdw; 42 42 MOV shadowBias.x, 0.0005; -
binaries/data/mods/public/shaders/glsl/terrain_common.fs
70 70 float get_shadow() 71 71 { 72 72 float shadowBias = 0.0005; 73 #if USE_SHADOW 73 #if USE_SHADOW && !DISABLE_RECEIVE_SHADOWS 74 74 float biasedShdwZ = v_shadow.z - shadowBias; 75 75 #if USE_SHADOW_SAMPLER 76 76 #if USE_SHADOW_PCF -
source/graphics/Decal.cpp
107 107 CRenderableObject::SetTransform(newTransform); 108 108 InvalidatePosition(); 109 109 } 110 111 void CModelDecal::RemoveShadows() 112 { 113 m_Decal.m_Material.AddShaderDefine("DISABLE_RECEIVE_SHADOWS", "1"); 114 } -
source/graphics/Decal.h
75 75 virtual void InvalidatePosition(); 76 76 virtual void SetTransform(const CMatrix3D& transform); 77 77 78 // remove shadow casting and receiving, recursively through props 79 void RemoveShadows(); 80 78 81 /** 79 82 * Compute the terrain vertex indexes that bound the decal's 80 83 * projection onto the terrain. -
source/graphics/Model.cpp
22 22 #include "precompiled.h" 23 23 24 24 #include "Model.h" 25 26 #include "Decal.h" 25 27 #include "ModelDef.h" 26 28 #include "maths/Quaternion.h" 27 29 #include "maths/BoundingBoxAligned.h" … … 631 633 m_Props[i].m_Model->ToCModel()->AddFlagsRec(flags); 632 634 } 633 635 636 void CModel::RemoveShadowsRec() 637 { 638 m_Flags &= ~MODELFLAG_CASTSHADOWS; 639 640 m_Material.AddShaderDefine("DISABLE_RECEIVE_SHADOWS", "1"); 641 642 for (size_t i = 0; i < m_Props.size(); ++i) 643 { 644 if (m_Props[i].m_Model->ToCModel()) 645 m_Props[i].m_Model->ToCModel()->RemoveShadowsRec(); 646 else if (m_Props[i].m_Model->ToCModelDecal()) 647 m_Props[i].m_Model->ToCModelDecal()->RemoveShadows(); 648 } 649 } 650 634 651 void CModel::SetMaterial(const CMaterial &material) 635 652 { 636 653 m_Material = material; -
source/graphics/Model.h
123 123 int GetFlags() const { return m_Flags; } 124 124 // add object flags, recursively through props 125 125 void AddFlagsRec(int flags); 126 // remove shadow casting and receiving, recursively through props 127 void RemoveShadowsRec(); 126 128 127 129 // recurse down tree setting dirty bits 128 130 virtual void SetDirtyRec(int dirtyflags) { -
source/simulation2/components/CCmpTemplateManager.cpp
525 525 if (out.GetChild("Entity").GetChild("Obstruction").IsOk()) 526 526 CParamNode::LoadXMLString(out, "<Entity><Obstruction><Active>false</Active></Obstruction></Entity>"); 527 527 528 if (out.GetChild("Entity").GetChild("VisualActor").IsOk()) 529 CParamNode::LoadXMLString(out, "<Entity><VisualActor><DisableShadows/></VisualActor></Entity>"); 530 528 531 if (!corpse) 529 532 { 530 533 // Previews should always be visible in fog-of-war/etc -
source/simulation2/components/CCmpVisualActor.cpp
121 121 "<empty/>" 122 122 "</element>" 123 123 "</optional>" 124 "<optional>" 125 "<element name='DisableShadows' a:help='Used internally; if present, shadows will be disabled'>" 126 "<empty/>" 127 "</element>" 128 "</optional>" 124 129 "<element name='SilhouetteDisplay'>" 125 130 "<data type='boolean'/>" 126 131 "</element>" … … 515 520 516 521 if (paramNode.GetChild("SilhouetteDisplay").ToBool()) 517 522 modelFlags |= MODELFLAG_SILHOUETTE_DISPLAY; 518 519 523 if (paramNode.GetChild("SilhouetteOccluder").ToBool()) 520 524 modelFlags |= MODELFLAG_SILHOUETTE_OCCLUDER; 521 525 … … 524 528 modelFlags |= MODELFLAG_IGNORE_LOS; 525 529 526 530 model.ToCModel()->AddFlagsRec(modelFlags); 531 532 if (paramNode.GetChild("DisableShadows").IsOk()) 533 model.ToCModel()->RemoveShadowsRec(); 527 534 } 528 535 529 536 // Initialize the model's selection shape descriptor. This currently relies on the component initialization order; the