Skip to content

Commit

Permalink
ed particles emitter yaw, pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Aug 30, 2024
1 parent d6f81b3 commit f2116a2
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
3 changes: 2 additions & 1 deletion docs/Roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Marked: `crucial`, **Next or Big**, _Important_.

fix splitscreen broken with refractions?

🌊**refract**? **crash** on: Surreal, HexForest, Bug, Glitch
🌊**refract** river roads **crash** on: Surreal, HexForest, Bug, Glitch
no water collis on: Butterfly, SlopeCity..
fix compositor / rqg:
car glass not refracted, offset, glass pipes not underwater
more fluids at once, blink on MilkyWay
Expand Down
6 changes: 6 additions & 0 deletions src/common/SceneEmitters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ void SEmitter::UpdEmitter()
ps->getEmitter(0)->setParameter("height", toStr(size.z));
ps->getEmitter(0)->setParameter("depth", toStr(size.y)); // h
ps->getEmitter(0)->setEmissionRate(rate);
Vector3 dir = SplineRoad::GetRot(yaw, pitch);
ps->getEmitter(0)->setDirection(dir);
//ps->getEmitter(0)->setAngle(roll);
//ps->getEmitter(0)->setParticleVelocity(minVel,maxVel); // todo?
//ps->getEmitter(0)->setMinTimeToLive(minTime);
//ps->getEmitter(0)->setMaxTimeToLive(maxTime);
}

void CScene::DestroyEmitters(bool clear)
Expand Down
3 changes: 2 additions & 1 deletion src/common/data/SceneClasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ class SEmitter // 🔥 Particles ⛅☢️
public:
std::string name; // particle_system
Ogre::Vector3 pos{0,0,0}, size{1,1,1};
Ogre::Vector3 up{0,1,0}; float rot = 0.f, velScale = 1.f; // dir todo:
float yaw = 0.f, pitch = -90.f; // dir angles
// Ogre::Vector3 dir{0,1,0}; float velScale = 1.f; // todo: dir
Ogre::Vector2 par{1,1}; // auto set original particle size from .emitter
float rate = 0.f; // emit
float parScale = 1.f;
Expand Down
4 changes: 2 additions & 2 deletions src/common/data/SceneXml_Load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ bool Scene::LoadXml(String file, bool bTer)

a = u->Attribute("pos"); if (a) p.pos = s2v(a);
a = u->Attribute("sc"); if (a) p.size = s2v(a);
a = u->Attribute("up"); if (a) p.up = s2v(a);
a = u->Attribute("rot"); if (a) p.rot = s2r(a);
a = u->Attribute("yaw"); if (a) p.yaw = s2r(a); // dir
a = u->Attribute("pt"); if (a) p.pitch = s2r(a);

a = u->Attribute("rate"); if (a) p.rate = s2r(a);
a = u->Attribute("st"); if (a) p.stat = s2i(a);
Expand Down
4 changes: 2 additions & 2 deletions src/common/data/SceneXml_Save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ bool Scene::SaveXml(String file)

oe->SetAttribute("pos", toStrC(e->pos));
oe->SetAttribute("sc", toStrC(e->size));
oe->SetAttribute("up", toStrC(e->up));
oe->SetAttribute("rot", toStrC(e->rot));
oe->SetAttribute("yaw", toStrC(e->yaw)); // dir
oe->SetAttribute("pt", toStrC(e->pitch));

oe->SetAttribute("rate", toStrC(e->rate));
oe->SetAttribute("st", e->stat ? 1 : 0);
Expand Down
2 changes: 1 addition & 1 deletion src/editor/Update_EditKeyTxt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ void App::KeyTxtEmitters(Real q)

// pos, rot, scale
emtTxt[2]->setCaption(String(emtEd==EO_Move ?"#60FF60":"")+ sPos +fToStr(e.pos.x,1,4)+" "+fToStr(e.pos.y,1,4)+" "+fToStr(e.pos.z,1,4));
emtTxt[3]->setCaption(String(emtEd==EO_Rotate?"#FFA0A0":"")+ sRot +"y " +fToStr(e.rot/*e.up.x*/,0,3) );
emtTxt[3]->setCaption(String(emtEd==EO_Rotate?"#FFA0A0":"")+ sRot +" " +fToStr(e.yaw,0,3) +" "+ fToStr(e.pitch,0,3) );
emtTxt[4]->setCaption(String(emtEd==EO_Scale ?"#60F0FF":"")+ sScl +fToStr(e.size.x,1,4)+" "+fToStr(e.size.y,1,4)+" "+fToStr(e.size.z,1,4));

emtTxt[5]->setCaption(TR("#{Size}: ") +fToStr(e.parScale,2,4)+" * "+fToStr(e.par.x,1,3) );
Expand Down
16 changes: 12 additions & 4 deletions src/editor/Update_EditMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,19 @@ void App::MouseEmitters()
em.pos.y += ym;
em.nd->setPosition(em.pos); em.nd->_getFullTransformUpdated(); UpdEmtBox();
}
else if (mbMiddle) // rot yaw
}else if (emtEd == EO_Rotate)
{
if (mbLeft) // rot y
{
Real xm = vNew.x * fRot * moveMul;
em.yaw += xm;
em.UpdEmitter();
}
else if (mbRight) // rot x
{
Real xm = vNew.x * fRot * moveMul * s;
em.rot += xm;
//em.nd->setOrientation(Quaternion(Degree(em.rot.x), em.up));
Real ym = vNew.x * fRot * moveMul;
em.pitch += ym;
em.UpdEmitter();
}
}else if(emtEd == EO_Scale)
{
Expand Down

0 comments on commit f2116a2

Please sign in to comment.