-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathParticleObj.cpp
57 lines (48 loc) · 1.66 KB
/
ParticleObj.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
56
57
#include "stdafx.h"
#include "ParticleObj.h"
#include "BaseApplication.h"
SceneParticleObj::SceneParticleObj( int tag, Ogre::String ParticleName )
{
BaseApplication* appMgr=BaseApplication::getInstance();
SceneObj();
mObjType=ParticleObj;
long t=GetTickCount();
mTag = tag + t;
char strtemp[30];
sprintf(strtemp,"ParticleObj%i",tag);
mUserName = strtemp;
sprintf(strtemp,"%s%ld",strtemp,t); //%ld±íʾlongÀàÐÍ//
mName=strtemp;
bVisualable=true;
mResName=ParticleName;
mPostion=Vector3::ZERO;
mScale=Vector3(1,1,1);
mRotaion=Vector3::ZERO;
mEntity=appMgr->mSceneMgr->createEntity("ParticlePointor.mesh");
mEntity->setMaterialName("ParticlePointor");
mNode=appMgr->mSceneMgr->createSceneNode();
mEntityNode=appMgr->mSceneMgr->createSceneNode(mName);
mEntityNode->attachObject(mEntity);
mParticleNode=appMgr->mSceneMgr->createSceneNode();
Ogre::String baseName, nameExt;
Ogre::StringUtil::splitBaseFilename(mResName,baseName,nameExt);
ParticleUniverse::ParticleSystemManager* pManager = ParticleUniverse::ParticleSystemManager::getSingletonPtr();
mParticle = pManager->createParticleSystem(mUserName,baseName, appMgr->mSceneMgr);
mParticleNode->attachObject(mParticle);
mNode->addChild(mEntityNode);
mNode->addChild(mParticleNode);
mParticle->prepare();
mParticle->start();
}
SceneParticleObj::~SceneParticleObj()
{
ParticleUniverse::ParticleSystemManager* pManager = ParticleUniverse::ParticleSystemManager::getSingletonPtr();
pManager->destroyParticleSystem(mUserName,BaseApplication::getInstance()->mSceneMgr);
}
void SceneParticleObj::onUpdateValueChange( int tag )
{
}
void SceneParticleObj::showBoundingBox(bool bShow)
{
mEntityNode->showBoundingBox(bShow);
}