forked from YutaTachibana0310/SankouGoudou2019Summer
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccelEffectController.cpp
55 lines (49 loc) · 1.5 KB
/
AccelEffectController.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//=====================================
//
//アクセルエフェクトコントローラ処理[AccelEffectController.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "AccelEffectController.h"
#include "AccelEffectParticle.h"
/**************************************
マクロ定義
***************************************/
#define ACCELEEFFECT_TEX_NAME "data/TEXTURE/Effect/AccelEffect.png"
#define ACCELEFFECT_NUM_MAX (512)
#define ACCELEFFECT_EMITTER_MAX (4)
#define ACCELEFFEFCT_EMIT_NUM (50)
/**************************************
初期化処理
***************************************/
void AccelEffectController::Init()
{
D3DXVECTOR2 ACCELEEFFECT_TEX_DIV = D3DXVECTOR2(1.0f, 1.0f);
D3DXVECTOR2 ACCELEFFECT_SIZE = D3DXVECTOR2(3.0f, 25.0f);
//単位頂点バッファ作成、テクスチャ読み込み
MakeUnitBuffer(&ACCELEFFECT_SIZE, &ACCELEEFFECT_TEX_DIV);
LoadTexture(ACCELEEFFECT_TEX_NAME);
//パーティクルコンテナ作成
particleContainer.resize(ACCELEFFECT_NUM_MAX);
for (auto& particle : particleContainer)
{
particle = new AccelEffectParticle();
}
//エミッタコンテナ作成
emitterContainer.resize(ACCELEFFECT_EMITTER_MAX);
for (auto& emitter : emitterContainer)
{
emitter = new AccelEffectParticleEmitter();
}
}
/**************************************
放出処理
***************************************/
void AccelEffectController::Emit()
{
ForEachEmitter(ACCELEFFEFCT_EMIT_NUM, [](BaseEmitter *emitter, BaseParticle* particle)
{
particle->transform = emitter->transform;
particle->Init();
});
}