MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / PrepareShadow

Method PrepareShadow

engine/Poseidon/Graphics/Rendering/Shape/Shadow.cpp:538–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536bool NoFogNeeded(float dist2, const Shape* shape, float bRadius);
537
538Ref<Shape> Object::PrepareShadow(int level, Vector3Par shadowPos, const FrameBase& frame)
539{
540 Ref<Shape> ret;
541 // shadows can be less detailed than objects
542 PoseidonAssert(level >= 0);
543
544 // prepare shadow for drawing
545 bool someAnim = IsAnimatedShadow(level);
546 if (someAnim || (!_static && !ShadowPoseFrozen()))
547 {
548 // do not cache shadows of dynamic objects
549 // if there is some animated texture
550 // it must be animated even in the shadow object
551 Animate(level);
552 // note: object may be destroyed
553 // in that case we need destroyed shadow?
554 ret = RecalcShadow(level, frame, true);
555 Deanimate(level);
556 }
557 else
558 {
559 if (!_static)
560 {
561 // frozen-pose dynamic caster actually routed through the cache
562 Poseidon::gShadowFrozenRouted++;
563 }
564 // if there exists pre-calculated shadow, use it
565 Matrix4 pos;
566 pos.SetOrientation(M3Identity);
567 pos.SetPosition(shadowPos);
568 ret = GScene->GetShadowCache().Shadow(this, GScene->MainLight()->ShadowDirection(), level, pos);
569 }
570 return ret;
571}
572
573void Object::DrawShadow(Shape* shadow, Vector3Par shadowPos, ClipFlags clipFlags, const FrameBase& frame)
574{

Callers 1

DrawExShadowMethod · 0.80

Calls 9

ShadowPoseFrozenFunction · 0.85
AnimateFunction · 0.85
DeanimateFunction · 0.85
ShadowDirectionMethod · 0.80
MainLightMethod · 0.80
IsAnimatedShadowFunction · 0.50
SetOrientationMethod · 0.45
SetPositionMethod · 0.45
ShadowMethod · 0.45

Tested by

no test coverage detected