-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66fec2e
commit 9f9370c
Showing
6 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef M3D_M_ANMCHRBLEND_H | ||
#define M3D_M_ANMCHRBLEND_H | ||
|
||
#include <m/m3d/m_anmchr.h> | ||
#include <m/m3d/m_banm.h> | ||
#include <m/m3d/m_bmdl.h> | ||
#include <nw4r/g3d/g3d_anmchr.h> | ||
|
||
namespace m3d { | ||
|
||
class anmChrBlend_c : public banm_c { | ||
public: | ||
virtual ~anmChrBlend_c(); | ||
|
||
virtual int getType() override; | ||
|
||
bool create(nw4r::g3d::ResMdl, int, mAllocator_c *, u32 *); | ||
bool attach(int, nw4r::g3d::AnmObjChrRes *, f32); | ||
bool attach(int, anmChr_c *, f32); | ||
void detach(int); | ||
// Not in NSMBW | ||
void setWeight(int, f32); | ||
f32 getWeight(int) const; | ||
}; | ||
|
||
} // namespace m3d | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include <m/m3d/m3d.h> | ||
#include <m/m3d/m_anmchrblend.h> | ||
#include <nw4r/g3d/g3d_anmchr.h> | ||
#include <nw4r/g3d/g3d_resanmchr.h> | ||
|
||
namespace m3d { | ||
|
||
anmChrBlend_c::~anmChrBlend_c() {} | ||
|
||
int anmChrBlend_c::getType() { | ||
return 0; | ||
} | ||
|
||
bool anmChrBlend_c::create(nw4r::g3d::ResMdl mdl, int num, mAllocator_c *alloc, u32 *pSize) { | ||
if (alloc == nullptr) { | ||
alloc = internal::l_allocator_p; | ||
} | ||
|
||
u32 size; | ||
if (pSize == nullptr) { | ||
pSize = &size; | ||
} | ||
|
||
nw4r::g3d::AnmObjChrBlend::Construct(nullptr, pSize, mdl, num); | ||
if (!createAllocator(alloc, pSize)) { | ||
return false; | ||
} | ||
|
||
mpAnmObj = nw4r::g3d::AnmObjChrBlend::Construct(&mAllocator, &size, mdl, num); | ||
return true; | ||
} | ||
|
||
bool anmChrBlend_c::attach(int idx, nw4r::g3d::AnmObjChrRes *anm, f32 weight) { | ||
nw4r::g3d::AnmObjChrBlend *obj = nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj); | ||
obj->SetWeight(idx, weight); | ||
obj->Attach(idx, anm); | ||
} | ||
|
||
bool anmChrBlend_c::attach(int idx, anmChr_c *anm, f32 weight) { | ||
nw4r::g3d::AnmObjChrRes *res = nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrRes>(anm->getAnimObj()); | ||
attach(idx, res, weight); | ||
} | ||
|
||
void anmChrBlend_c::detach(int idx) { | ||
nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj)->Detach(idx); | ||
} | ||
|
||
void anmChrBlend_c::setWeight(int idx, f32 weight) { | ||
nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj)->SetWeight(idx, weight); | ||
} | ||
|
||
f32 anmChrBlend_c::getWeight(int idx) const { | ||
nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj)->GetWeight(idx); | ||
} | ||
|
||
} // namespace m3d |