Skip to content

Commit

Permalink
モーフによるフレーム指定式を追加 #9
Browse files Browse the repository at this point in the history
  • Loading branch information
oigami committed Nov 19, 2016
1 parent 0effda8 commit fad1863
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion EffekseerForMMD/effekseer_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ namespace efk
{
auto_play_morph_id_ = j;
}
else if ( strcmp(getFrameMorphName(), name) == 0 )
{
frame_morph_id_ = j;
}
}
for ( int j = 0, len = ExpGetPmdBoneNum(i); j < len; ++j )
{
Expand All @@ -101,6 +105,8 @@ namespace efk

const char* PMDResource::getAutoPlayMorphName() { return ExpGetEnglishMode() ? "auto play" : "オート再生"; }

const char* PMDResource::getFrameMorphName() { return ExpGetEnglishMode() ? "frame" : "フレーム"; }

const char* PMDResource::getPlayBoneName() { return ExpGetEnglishMode() ? "play" : "再生"; }

const char* PMDResource::getCenterBone() { return ExpGetEnglishMode() ? "center" : "センター"; }
Expand All @@ -111,6 +117,8 @@ namespace efk

float PMDResource::autoPlayVal(int i) const { return auto_play_morph_id_ == -1 ? 0 : ExpGetPmdMorphValue(i, auto_play_morph_id_); }

float PMDResource::frameVal(int i) const { return frame_morph_id_ == -1 ? 0 : ExpGetPmdMorphValue(i, frame_morph_id_); }

D3DMATRIX PMDResource::playBone(int i) const { return play_bone_id_ == -1 ? D3DMATRIX{ 0 } : ExpGetPmdBoneWorldMat(i, play_bone_id_); }

D3DMATRIX PMDResource::centerBone(int i) const { return center_bone_id_ == -1 ? D3DMATRIX{ 0 } : ExpGetPmdBoneWorldMat(i, center_bone_id_); }
Expand Down Expand Up @@ -330,7 +338,7 @@ namespace efk
{
// フレーム方式
auto play_mat = effect.resource.playBone(i);
double play_time = play_mat.m[3][1];
double play_time = play_mat.m[3][1] + effect.resource.frameVal(i) * 100.0f;
play_time = play_time - 0.5;

effect.update(static_cast<float>(play_time));
Expand Down
4 changes: 4 additions & 0 deletions EffekseerForMMD/effekseer_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace efk

float triggerVal(int i) const;
float autoPlayVal(int i) const;
float frameVal(int i) const;

D3DMATRIX playBone(int i) const;
D3DMATRIX centerBone(int i) const;
D3DMATRIX baseBone(int i) const;
Expand All @@ -21,13 +23,15 @@ namespace efk

static const char* getTriggerMorphName();
static const char* getAutoPlayMorphName();
static const char* getFrameMorphName();

static const char* getPlayBoneName();
static const char* getCenterBone();
static const char* getBaseBone();

int trigger_morph_id_ = -1;
int auto_play_morph_id_ = -1;
int frame_morph_id_ = -1;

int play_bone_id_ = -1;
int center_bone_id_ = -1;
Expand Down

0 comments on commit fad1863

Please sign in to comment.