Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/particles.cc')
-rw-r--r--src/render/particles.cc253
1 files changed, 0 insertions, 253 deletions
diff --git a/src/render/particles.cc b/src/render/particles.cc
index fc27234..5e41316 100644
--- a/src/render/particles.cc
+++ b/src/render/particles.cc
@@ -28,259 +28,6 @@ Particle::Particle(const math::Vector3f &location, const math::Axis &axis, float
}
-/* ---- static ParticleScript registry ---------------------------------- */
-
-ParticleScript::Registry ParticleScript::particlescript_registry;
-
-void ParticleScript::list()
-{
-
- for (Registry::const_iterator it = particlescript_registry.begin(); it != particlescript_registry.end(); it++) {
-
- const ParticleScript *script = (*it).second;
-
- std::string strval;
- size_t count = 0;
- while (script) {
-
- switch (script->type()) {
- case Flame:
- strval.append(" flame");
- break;
- case Jet:
- strval.append(" jet");
- break;
- case Spray:
- strval.append(" spray");
- break;
- case Trail:
- strval.append(" trail");
- break;
- }
-
- count++;
- script = script->next();
- }
- con_print << " " << (*it).second->label() << strval << " " << count << " " << aux::plural("ejector", count) << std::endl;
- }
- con_print << particlescript_registry.size() << " particle scripts" << std::endl;
-}
-
-void ParticleScript::clear()
-{
- for (Registry::iterator it = particlescript_registry.begin(); it != particlescript_registry.end(); it++) {
- delete(*it).second;
- (*it).second = 0;
- }
- particlescript_registry.clear();
-}
-
-ParticleScript *ParticleScript::find(const std::string &label)
-{
- Registry::iterator it = particlescript_registry.find(label);
-
- if (it != particlescript_registry.end()) {
- return (*it).second;
- } else {
- return 0;
- }
-}
-
-ParticleScript *ParticleScript::load(const std::string &label)
-{
- ParticleScript *parent_script = find(label);
- if (parent_script)
- return parent_script;
-
- filesystem::IniFile inifile;
-
- inifile.open("particles/" + label);
-
- if (!inifile.is_open()) {
- con_warn << "Could not open " << inifile.name() << std::endl;
- return 0;
- }
-
- ParticleScript *script = 0;
- std::string strval;
- float pitch, yaw, roll = 0.0f;
- bool b;
-
- while (inifile.getline()) {
-
- if (inifile.got_section()) {
-
- if (inifile.got_section("particles")) {
- if (script) {
- script->particlescript_next = new ParticleScript(std::string());
- script = script->particlescript_next;
- } else {
- script = new ParticleScript(label);
- particlescript_registry[script->label()] = script;
- parent_script = script;
- }
- continue;
- } else {
- inifile.unknown_section();
- }
-
- } else if (inifile.got_key()) {
-
- if (inifile.in_section("particles")) {
-
- if (inifile.got_key_string("type", strval)) {
- aux::to_label(strval);
- if (strval.compare("flame") == 0) {
- script->particlescript_type = ParticleScript::Flame;
- } else if (strval.compare("jet") == 0) {
- script->particlescript_type = ParticleScript::Jet;
- } else if (strval.compare("trail") == 0) {
- script->particlescript_type = ParticleScript::Trail;
- } else if (strval.compare("spray") == 0) {
- script->particlescript_type = ParticleScript::Spray;
- } else {
- inifile.unknown_value();
- }
- continue;
-
- } else if (inifile.got_key_string("cull", strval)) {
- aux::to_label(strval);
- if (strval.compare("none") == 0) {
- script->particlescript_cull = model::CullNone;
- } else if (strval.compare("back") == 0) {
- script->particlescript_cull = model::CullBack;
- } else if (strval.compare("front") == 0) {
- script->particlescript_cull = model::CullFront;
- } else {
- inifile.unknown_value();
- }
- continue;
-
- } else if (inifile.got_key_string("texture", script->particlescript_texture)) {
- Textures::load("textures/" + script->texture());
- continue;
- } else if (inifile.got_key_float("speed", script->particlescript_speed)) {
- continue;
- } else if (inifile.got_key_float("offset", script->particlescript_offset)) {
- math::clamp(script->particlescript_offset, 0.0f, 1.0f);
- continue;
- } else if (inifile.got_key_float("alpha", script->particlescript_alpha)) {
- continue;
- } else if (inifile.got_key_float("radius", script->particlescript_radius)) {
- script->particlescript_radius *= model::SCALE;
- continue;
- } else if (inifile.got_key_float("eject", script->particlescript_eject)) {
- continue;
- } else if (inifile.got_key_float("timeout", script->particlescript_timeout)) {
- continue;
- } else if (inifile.got_key_color("color", script->particlescript_color)) {
- continue;
- } else if (inifile.got_key_bool("engine", script->particlescript_engine)) {
- continue;
- } else if (inifile.got_key_bool("entity", script->particlescript_entity)) {
- continue;
- } else if (inifile.got_key_bool("entitysecond", script->particlescript_entity_second)) {
- continue;
- } else if (inifile.got_key_bool("entitythird", b)) {
- if (b) {
- script->particlescript_entity = true;
- script->particlescript_entity_second = true;
- }
- continue;
- } else if (inifile.got_key_float("angle", yaw)) {
-
- if (yaw == model::ANGLEUP) {
- script->particlescript_axis.change_pitch(-90.0f);
- } else if (yaw == model::ANGLEDOWN) {
- script->particlescript_axis.change_pitch(90.0f);
- } else {
- script->particlescript_axis.change_direction(yaw);
- }
- continue;
-
- } else if (inifile.got_key("angles")) {
-
- std::istringstream str(inifile.value());
- if (str >> pitch >> yaw >> roll) {
- script->particlescript_axis.assign(yaw, pitch, roll);
- } else {
- inifile.unknown_value();
- }
- continue;
-
- } else if (inifile.got_key_float("pitch", pitch)) {
- script->particlescript_axis.change_pitch(-pitch);
- continue;
-
- } else if (inifile.got_key_float("yaw", yaw)) {
- script->particlescript_axis.change_direction(yaw);
- continue;
-
- } else if (inifile.got_key_float("roll", roll)) {
- script->particlescript_axis.change_roll(-roll);
- continue;
-
- } else {
- inifile.unknown_key();
- }
- }
- }
- }
-
- inifile.close();
-
- strval.clear();
-
- size_t count = 0;
- for (script = parent_script; script != 0; script = script->particlescript_next) {
- switch (script->type()) {
- case Flame:
- strval.append(" flame");
- break;
- case Jet:
- strval.append(" jet");
- break;
- case Spray:
- strval.append(" spray");
- break;
- case Trail:
- strval.append(" trail");
- break;
- }
- count++;
- }
- con_debug << " " << inifile.name() << strval << " " << count << " " << aux::plural("ejector", count) << std::endl;
-
- return parent_script;
-}
-
-/* ---- class ParticleScript --------------------------------------- */
-
-ParticleScript::ParticleScript(const std::string & label) : particlescript_label(label)
-{
- particlescript_entity = false;
- particlescript_entity_second = false;
- particlescript_engine = false;
- particlescript_radius = 1.0f;
- particlescript_alpha = 1.0f;
-
- particlescript_speed = 0.0f;
- particlescript_timeout = 2.0f;
- particlescript_eject = 0.25f;
- particlescript_offset = 0.1f;
-
- particlescript_color.assign(1.0f, 1.0f);
- particlescript_cull = model::CullNone;
-
- particlescript_next = 0;
-}
-
-ParticleScript::~ParticleScript()
-{
- if (particlescript_next) {
- delete particlescript_next;
- }
-}
/* ---- class ParticleSystem --------------------------------------- */