1#include "Game/LiveActor/ShadowVolumeDrawer.hpp"
2#include "Game/Scene/SceneObjHolder.hpp"
5 static Color8 sShapeColor(0xC0, 0xC0, 0, 4);
6 static Color8 sDebugShapeColor(0xFF, 0, 0, 0x80);
9ShadowVolumeDrawInit::ShadowVolumeDrawInit() :
NameObj(
"シャドウボリューム描画初期化") {
11 MR::registerPreDrawFunction(func, 0x27);
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);
22void ShadowVolumeDrawer::setStartDrawShepeOffset(f32 offs) {
23 mStartDrawShapeOffset = offs;
26void ShadowVolumeDrawer::setEndDrawShepeOffset(f32 offs) {
27 mEndDrawShapeOffset = offs;
30void ShadowVolumeDrawer::onCutDropShadow() {
31 mIsCutDropShadow =
true;
34void ShadowVolumeDrawer::offCutDropShadow() {
35 mIsCutDropShadow =
false;
38void ShadowVolumeDrawer::calcBaseDropPosition(TVec3f *pVec)
const {
39 calcBaseDropPosition(pVec, getController());
42f32 ShadowVolumeDrawer::calcBaseDropLength()
const {
43 return calcBaseDropLength(getController());
48f32 ShadowVolumeDrawer::calcBaseDropLength(
const ShadowController *pController)
const {
49 f32 length = pController->getDropLength();
51 if (mIsCutDropShadow) {
52 if (pController->isProjected()) {
53 length = pController->getProjectionLength();
57 f32 negStart = -mStartDrawShapeOffset;
58 length += mEndDrawShapeOffset + negStart;
63void ShadowVolumeDrawer::loadModelDrawMtx()
const {
67void ShadowVolumeDrawer::drawShape()
const {
71bool ShadowVolumeDrawer::isDraw()
const {
72 return getController()->isDraw();
78 GXColor shapeColor =
reinterpret_cast<GXColor&
>(sShapeColor);
79 GXSetTevColor(GX_TEVREG0, shapeColor);
82 GXSetCullMode(GX_CULL_FRONT);
83 GXSetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ONE, GX_LO_COPY);
85 GXSetCullMode(GX_CULL_BACK);
86 GXSetBlendMode(GX_BM_SUBTRACT, GX_BL_ZERO, GX_BL_ZERO, GX_LO_COPY);
88 GXSetCullMode(GX_CULL_NONE);
94ShadowVolumeDrawInit::~ShadowVolumeDrawInit() {
The most basic form of an object.
virtual void draw() const
Draws the object. Does nothing until overridden.