Example #1
0
void Canvas::changeModelFile( const std::string& fileName )
{
	size_t dotPos = fileName.find('.');
	if (dotPos == std::string::npos)
	{
		return;
	}
	std::string suffix = fileName.substr(dotPos, fileName.size() - dotPos);
	std::transform(suffix.begin(), suffix.end(), suffix.begin(), std::tolower);
	if (suffix == ".group")
	{
		_destroymodel();
		_clearModel();
		_model = new Group;
	}
	else if (suffix == ".entity")
	{
		_destroymodel();
		_clearModel();
		_model = new Entity;
	} 
	else if(suffix == ".mesh")
	{
		_destroymodel();
		_clearModel();
		_model = new Geometry;
	}
	else if(suffix == ".mz")
	{
		_destroymodel();
		_clearModel();
		_model = new MzModel;
	}
	else if(suffix == ".subentity")
	{
		_destroymodel();
		_clearModel();
		_model = new SubEntity;
	}
	else
	{
		return;
	}

	_model->decode(fileName); 
	_createModel();
	for (size_t i = 0; i != _observers.size(); ++i)
	{
		_observers[i]->update(_model);
	}
}
Example #2
0
	LRESULT CViewWindow::onDestroy(UINT, WPARAM, LPARAM, BOOL&) 
	{
		mSculptor.destroy();
		gTerrain.destroy();
		delete EventManager::getInstancePtr();
		if (RenderEngineImp::getInstancePtr()->isInitialized())
		{
			_sphere.destroy();
			if (_material)
			{
				_material->destroy();
				delete _material;
				_material = 0;
			}
			//
			if (_vb)
			{
				_vb->destroy();
				delete _vb;
				_vb = NULL;
			}
			_destroymodel();
			RenderEngineImp::getInstancePtr()->destroy();
			delete RenderEngineImp::getInstancePtr();
		}

		delete Zen::Logger::getInstancePtr();
		//
		return 1;
	}
Example #3
0
	void CViewWindow::changeModelFile( const std::string& fileName )
	{
		size_t dotPos = fileName.find('.');
		if (dotPos == std::string::npos)
		{
			return;
		}
		std::string suffix = fileName.substr(dotPos, fileName.size() - dotPos);
		std::transform(suffix.begin(), suffix.end(), suffix.begin(), std::tolower);
		EventArgsCTreeDlgChangeFile args;
		if(suffix == ".subentity")
		{
			_destroymodel();
			_clearModel();
			_model = new SubEntity;
			args.mType = eVisibleObjectType_SubEntity;
		}
		else if(suffix == ".entity")
		{
			_destroymodel();
			_clearModel();
			_model = new Entity;
			args.mType = eVisibleObjectType_Entity;
		}
		else if(suffix == ".mz")
		{
			_destroymodel();
			_clearModel();
			_model = new MzModel;
			args.mType = eVisibleObjectType_MzModel;
		}
		else
		{
			return;
		}
		std::string name = Zen::FileSystem::getInstancePtr()->standardFilePath(fileName);	
		_model->decode(name);
		//
		args.mPrimitive = _model;
		EventManager::getInstancePtr()->fireEvent(eEvent_CTreeDlgChangeFile, &args);
	}
Example #4
0
void Canvas::destroy()
{
	if (!_isInitialized())
	{
		return;
	}
	_destroymodel();
	RenderEngineImp::getInstancePtr()->destroy();
	delete RenderEngineImp::getInstancePtr();

	delete Buddha::Logger::getInstancePtr();
	//
	_clear();
}