1#include "Game/MapObj/SpinDriverPathDrawer.hpp"
2#include "Game/Scene/SceneObjHolder.hpp"
3#include "Game/Util.hpp"
4#include "Game/Util/DirectDraw.hpp"
7SpinDriverPathDrawInit::SpinDriverPathDrawInit() :
NameObj(
"スピンドライバーレール描画初期化"),
8 mOrangeTexture(nullptr), mGreenTexture(nullptr), mPinkTexture(nullptr), mMaskTexture(nullptr), mIsPathAtOpa(false) {
11 MR::registerPreDrawFunction(MR::Functor(
this, drawFunc), 18);
12 mOrangeTexture =
new JUTTexture(MR::loadTexFromArc(
"SpinDriverPath.arc",
"NormalColor.bti"), 0);
13 mGreenTexture =
new JUTTexture(MR::loadTexFromArc(
"SpinDriverPath.arc",
"Green.bti"), 0);
14 mPinkTexture =
new JUTTexture(MR::loadTexFromArc(
"SpinDriverPath.arc",
"Pink.bti"), 0);
15 mMaskTexture =
new JUTTexture(MR::loadTexFromArc(
"SpinDriverPath.arc",
"Mask.bti"), 0);
19 mShootPath = pShootPath;
32 mMaskLength = 5000.0f;
33 MR::createSceneObj(SceneObj_SpinDrawerPathDrawInit);
37void SpinDriverPathDrawInit::initDraw() {
38 TDDraw::cameraInit3D();
39 GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
40 GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_POS_XYZ, GX_F32, 0);
42 GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
43 GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
44 GXLoadPosMtxImm(MR::getCameraViewMtx(), 0);
48 GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x1E, 0, 0x7D);
49 GXSetTexCoordGen2(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, 0x21, 0, 0x7D);
51 GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
52 GXSetTevOp(GX_TEVSTAGE0, GX_REPLACE);
53 GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR_NULL);
54 GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_CPREV, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO);
55 GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV);
56 GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_TEXA, GX_CA_ZERO);
57 GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV);
58 GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_ONE, GX_LO_CLEAR);
59 GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0);
60 GXSetZMode(1, GX_LEQUAL, 0);
62 GXSetCullMode(GX_CULL_NONE);
63 GXSetClipMode(GX_CLIP_ENABLE);
65 GXSetFog(GX_FOG_NONE, 0.0f, 0.0f, 0.0f, 0.0f, (GXColor&)color);
66 GXSetFogRangeAdj(GX_FALSE, 0,
nullptr);
67 mMaskTexture->load(GX_TEXMAP1);
72 void setSpinDriverPathColorNormal() {
73 MR::getSceneObj<SpinDriverPathDrawInit*>(SceneObj_SpinDrawerPathDrawInit)->mOrangeTexture->load(GX_TEXMAP0);
76 void setSpinDriverPathColorGreen() {
77 MR::getSceneObj<SpinDriverPathDrawInit*>(SceneObj_SpinDrawerPathDrawInit)->mGreenTexture->load(GX_TEXMAP0);
80 void setSpinDriverPathColorPink() {
81 MR::getSceneObj<SpinDriverPathDrawInit*>(SceneObj_SpinDrawerPathDrawInit)->mPinkTexture->load(GX_TEXMAP0);
84 bool isDrawSpinDriverPathAtOpa() {
85 if (!MR::isExistSceneObj(SceneObj_SpinDrawerPathDrawInit)) {
89 return MR::getSceneObj<SpinDriverPathDrawInit*>(SceneObj_SpinDrawerPathDrawInit)->mIsPathAtOpa;
92 void onDrawSpinDriverPathAtOpa() {
93 MR::getSceneObj<SpinDriverPathDrawInit*>(SceneObj_SpinDrawerPathDrawInit)->mIsPathAtOpa =
true;
96 void offDrawSpinDriverPathAtOpa() {
97 MR::getSceneObj<SpinDriverPathDrawInit*>(SceneObj_SpinDrawerPathDrawInit)->mIsPathAtOpa =
false;
102 MR::connectToScene(
this, -1, -1, -1, 0x12);
103 initPositionList(75.0f, 20.0f);
112void SpinDriverPathDrawer::initClipping() {
114 mShootPath->calcClippingInfo(&
mPosition, &v3, 150.0f, 150.0f);
115 MR::setClippingTypeSphere(
this, v3);
116 MR::validateClipping(
this);
117 MR::setClippingFarMax(
this);
120void SpinDriverPathDrawer::initPathEnd() {
122 MR::getRailArg1WithInit(mShootPath->mRailRider, &arg);
132f32 SpinDriverPathDrawer::calcDrawCode()
const {
137 f32 val = 1.0f - _B8;
138 f32 ret = (_AC < val) ? _AC : val;
142f32 SpinDriverPathDrawer::calcDrawBaseCode()
const {
149 if (val < (1.0f - _B8)) {
156void SpinDriverPathDrawer::setCoord(f32 coord) {
163void SpinDriverPathDrawer::setColorNormal() {
167void SpinDriverPathDrawer::setColorGreen() {
171void SpinDriverPathDrawer::setColorPink() {
175void SpinDriverPathDrawer::setMaskLength(f32 mask) {
184void SpinDriverPathDrawer::setFadeScale(f32 fade) {
195void SpinDriverPathDrawer::sendPoint(
const TVec3f &a1, f32 a2, f32 a3) {
203SpinDriverPathDrawer::~SpinDriverPathDrawer() {
207SpinDriverPathDrawInit::~SpinDriverPathDrawInit() {
The basis of a drawable actor that can contain states (see: Nerve)
TVec3f mPosition
3D vector of the actor's position.
The most basic form of an object.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.