Results 1 to 5 of 5

Thread: Particle Universe can't load particle systems

  1. #1
    Join Date
    Jun 2011
    Posts
    85

    Particle Universe can't load particle systems

    I have been troubleshooting with my Ogre game project. The Particle Universe plug-in seems to be crash in PUSystemManager.cpp because it is not loading with Ogre’s dynamic lib system. Also it does not work if you load it as a regular DLL. I tried all the possible ways that I could but nothing happened. What should I do? Please help me to solve it as soon as possible.

  2. #2
    Join Date
    May 2009
    Posts
    539

    Re: Particle Universe can't load particle systems

    After reading your question it reflects that your pManager variable is in Null (0x00000001) Fact. Initialize it and use it properly so that you can create a particle system with it. First set a breakpoint at the line of code as per the following:
    Code:
    ParticleUniverse::ParticleSystem* ssys = pManager->createParticleSystem
    ("hit1", "hit1" , GSYS->GetSceneMgr());
    
    the ParticleManager constructor initialized it like this -
    
    ParticleManager::ParticleManager()
    {
    pManager = NULL;
    pnode = NULL;
    }

  3. #3
    Join Date
    May 2009
    Posts
    637

    Re: Particle Universe can't load particle systems

    According to me the ParticleManager.h file looks like this:
    Code:
    Copyright (c) 2010 Yunus Kara
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
    */
    
    #include "StdAfx.h"
    #include "ParticleManager.h"
    #include "GraphicsSystem.h"
    #include "xml/tinyxml.h"
    using namespace Ogre;
    
    template<> ParticleManager* Ogre::Singleton<ParticleManager>::ms_Singleton = 0;
    
    ParticleManager* ParticleManager::getSingletonPtr(void)
    {
    	return ms_Singleton;
    }
    
    ParticleManager& ParticleManager::getSingleton(void)
    {  
    	assert( ms_Singleton );  return ( *ms_Singleton );
    }
    
    ParticleManager::ParticleManager()
    {
    	pManager = NULL;
    	pnode = NULL;
    }
    
    ParticleManager::~ParticleManager()
    {
    	Finalize();
    }
    
    void ParticleManager::Initialize()
    {
    	//get mgr
    	
    	pManager = ParticleUniverse::ParticleSystemManager::getSingletonPtr();
    
    	//create node
    	pnode = GSYS->GetSceneMgr()->getRootSceneNode()->createChildSceneNode("ParticleManagerNode");
    
    	//read xml & load sets
    	DataStreamPtr data = ResourceGroupManager::getSingleton().openResource("particles.xml");
    	String str = data->getAsString();
    	TiXmlDocument doc;
    	doc.Parse(str.c_str());
    
    	if (!doc.Error())
    	{
    		TiXmlNode* node;
    		node=doc.FirstChild();
    		node=node->FirstChild();
    		TiXmlAttribute* att;
    		for (;node!=0;node=node->NextSibling()) 
    		{
    			if (node->Type() == TiXmlNode::ELEMENT)
    			{
    				//get params
    				String name = "";
    				String system = "";
    
    				if (strcmp(node->Value(), "particle") == 0)
    				{
    					TiXmlAttribute* att = node->ToElement()->FirstAttribute();
    					while (att)
    					{
    						if (strcmp(att->Name(), "name") == 0)
    						{
    							name = att->Value();
    						}
    						else if (strcmp(att->Name(), "system") == 0)
    						{
    							system = att->Value();
    						}
    						att = att->Next();
    					}
    
    					if (name.length() > 0)
    					{
    						//create
    						ParticleUniverse::ParticleSystem* psys = pManager->createParticleSystem("hit1", "hit1" , GSYS->GetSceneMgr());
    						pnode->attachObject(psys);
    						psys->prepare(); // added according to documentation, no effect yet
    						//finally add
    						syss[name] = psys;
    					}
    				}
    			}
    		}
    	}
    	else
    	{
    		throw Exception(Exception::ERR_FILE_NOT_FOUND, std::string(doc.ErrorDesc()) + " : particles.xml", __FUNCTION__);
    	}
    }
    
    void ParticleManager::Finalize()
    {
    	//remove pnode
    	pnode->detachAllObjects();
    	GSYS->GetSceneMgr()->getRootSceneNode()->removeAndDestroyChild(pnode->getName());
    	pnode = NULL;
    
    	//traverse all systems and delete all
    	std::map<Ogre::String, ParticleUniverse::ParticleSystem*>::iterator it;
    	it = syss.begin();
    	while (it != syss.end())
    	{
    		//remove
    		ParticleUniverse::ParticleSystem* psys = (*it).second;
    		psys->stop();
    		pManager->destroyParticleSystem(psys->getName(), GSYS->GetSceneMgr());
    		it++;
    	}
    	syss.clear();
    
    	//clear mgr.
    	pManager->destroyAllParticleSystems(GSYS->GetSceneMgr());
    	pManager = NULL;
    }
    
    void ParticleManager::Update()
    {
    }
    
    void ParticleManager::ShowParticle(String name, Vector3 pos, Vector3 dir)
    {
    	ParticleUniverse::ParticleSystem* psys = syss[name];
    	psys->getTechnique(0)->getEmitter(0)->position = pos;
    	psys->getTechnique(0)->getEmitter(0)->setParticleDirection(dir);
    	psys->start();
    }
    
    void ParticleManager::HideParticle(Ogre::String name)
    {
    	ParticleUniverse::ParticleSystem* psys = syss[name];
    	psys->stopFade();
    }

  4. #4
    Join Date
    May 2009
    Posts
    511

    Re: Particle Universe can't load particle systems

    The pManager is ParticleManager type and a pointer to an object. As soon as you call the createParticleSystem() method, means that you are asking that object to do something. As the pManager is not pointed to a valid object, there's nothing to make the request to. For that you have to create a ParticleManager object and point pManager before you can call any methods through that pointer. The easiest way to do is assign a “new ParticleManager” to the pointer. If you do this then you have to manually delete that object.

  5. #5
    Join Date
    May 2009
    Posts
    527

    Re: Particle Universe can't load particle systems

    You have to create a new particle. To create a new particle in the “new ParticleManager” you have to do some coding. As creation of a new particle is done by means of the ParticleSystemManager .Use the following code to procede:
    Code:
    ParticleUniverse::ParticleSystemManager* pManager =
    ParticleUniverse::ParticleSystemManager::getSingletonPtr();
    ParticleUniverse::ParticleSystem* pSys = pManager->createParticleSystem(“mySys”,
    “nameOfTemplateScript”, mSceneManager);
    mNode->attachObject(pSys);

Similar Threads

  1. Anyone can tell me in simple words about God Particle?
    By Wazza10Roo in forum Off Topic Chat
    Replies: 7
    Last Post: 09-07-2012, 02:14 PM
  2. Replies: 1
    Last Post: 24-04-2012, 05:40 PM
  3. quick demo with the flash player 11 beta mass particle
    By Mallory c in forum Windows Software
    Replies: 5
    Last Post: 11-08-2011, 11:02 PM
  4. Cpanel Load slow and repquota 100% with high load
    By Character in forum Software Development
    Replies: 4
    Last Post: 17-06-2010, 12:36 AM
  5. DC Universe Online
    By Scubie67 in forum Video Games
    Replies: 4
    Last Post: 03-12-2008, 03:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,182,039.61806 seconds with 17 queries