SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
ShadowVolumeDrawer.cpp
1#include "Game/LiveActor/ShadowVolumeDrawer.hpp"
2#include "Game/Scene/SceneObjHolder.hpp"
3
4namespace {
5 static Color8 sShapeColor(0xC0, 0xC0, 0, 4);
6 static Color8 sDebugShapeColor(0xFF, 0, 0, 0x80);
7};
8
9ShadowVolumeDrawInit::ShadowVolumeDrawInit() : NameObj("シャドウボリューム描画初期化") {
10 MR::FunctorV0F func(*MR::setupShadowVolumeDraw);
11 MR::registerPreDrawFunction(func, 0x27);
12}
13
14ShadowVolumeDrawer::ShadowVolumeDrawer(const char *pName) : ShadowDrawer(pName) {
15 mStartDrawShapeOffset = 0.0f;
16 mEndDrawShapeOffset = 0.0f;
17 mIsCutDropShadow = false;
18 MR::createSceneObj(SceneObj_ShadowVolumeDrawer);
19 MR::connectToScene(this, -1, -1, -1, 0x27);
20}
21
22void ShadowVolumeDrawer::setStartDrawShepeOffset(f32 offs) {
23 mStartDrawShapeOffset = offs;
24}
25
26void ShadowVolumeDrawer::setEndDrawShepeOffset(f32 offs) {
27 mEndDrawShapeOffset = offs;
28}
29
30void ShadowVolumeDrawer::onCutDropShadow() {
31 mIsCutDropShadow = true;
32}
33
34void ShadowVolumeDrawer::offCutDropShadow() {
35 mIsCutDropShadow = false;
36}
37
38void ShadowVolumeDrawer::calcBaseDropPosition(TVec3f *pVec) const {
39 calcBaseDropPosition(pVec, getController());
40}
41
42f32 ShadowVolumeDrawer::calcBaseDropLength() const {
43 return calcBaseDropLength(getController());
44}
45
46#ifdef NON_MATCHING
47// reg usage issues at the bottom
48f32 ShadowVolumeDrawer::calcBaseDropLength(const ShadowController *pController) const {
49 f32 length = pController->getDropLength();
50
51 if (mIsCutDropShadow) {
52 if (pController->isProjected()) {
53 length = pController->getProjectionLength();
54 }
55 }
56
57 f32 negStart = -mStartDrawShapeOffset;
58 length += mEndDrawShapeOffset + negStart;
59 return length;
60}
61#endif
62
63void ShadowVolumeDrawer::loadModelDrawMtx() const {
64
65}
66
67void ShadowVolumeDrawer::drawShape() const {
68
69}
70
71bool ShadowVolumeDrawer::isDraw() const {
72 return getController()->isDraw();
73}
74
76 if (isDraw()) {
77 loadModelDrawMtx();
78 GXColor shapeColor = reinterpret_cast<GXColor&>(sShapeColor);
79 GXSetTevColor(GX_TEVREG0, shapeColor);
80 GXSetColorUpdate(0);
81 GXSetDstAlpha(0, 0);
82 GXSetCullMode(GX_CULL_FRONT);
83 GXSetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ONE, GX_LO_COPY);
84 drawShape();
85 GXSetCullMode(GX_CULL_BACK);
86 GXSetBlendMode(GX_BM_SUBTRACT, GX_BL_ZERO, GX_BL_ZERO, GX_LO_COPY);
87 drawShape();
88 GXSetCullMode(GX_CULL_NONE);
89 GXSetColorUpdate(1);
90 GXSetDstAlpha(1, 0);
91 }
92}
93
94ShadowVolumeDrawInit::~ShadowVolumeDrawInit() {
95
96}
The most basic form of an object.
Definition NameObj.hpp:11
virtual void draw() const
Draws the object. Does nothing until overridden.