コード例 #1
0
void moveSelectedCmd(const cmd::ArgumentList& args)
{
	if (args.size() != 1)
	{
		rMessage() << "Usage: moveSelectionVertically [up|down]" << std::endl;
		return;
	}

	UndoableCommand undo("moveSelectionVertically");

	std::string arg = boost::algorithm::to_lower_copy(args[0].getString());

	if (arg == "up") 
	{
		moveSelectedAlongZ(GlobalGrid().getGridSize());
	}
	else if (arg == "down")
	{
		moveSelectedAlongZ(-GlobalGrid().getGridSize());
	}
	else
	{
		// Invalid argument
		rMessage() << "Usage: moveSelectionVertically [up|down]" << std::endl;
		return;
	}
}
コード例 #2
0
void OpenGLModule::sharedContextCreated()
{
	// report OpenGL information
	rMessage() << "GL_VENDOR: "
		<< reinterpret_cast<const char*>(glGetString(GL_VENDOR)) << std::endl;
	rMessage() << "GL_RENDERER: "
		<< reinterpret_cast<const char*>(glGetString(GL_RENDERER)) << std::endl;
	rMessage() << "GL_VERSION: "
		<< reinterpret_cast<const char*>(glGetString(GL_VERSION)) << std::endl;
	rMessage() << "GL_EXTENSIONS: "
		<< reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)) << std::endl;

	GLenum err = glewInit();

	if (err != GLEW_OK)
	{
		// glewInit failed
		rError() << "GLEW error: " <<
			reinterpret_cast<const char*>(glewGetErrorString(err));
	}

	GlobalRenderSystem().extensionsInitialised();
	GlobalRenderSystem().realise();

	_font.reset(new wxutil::GLFont(wxutil::GLFont::FONT_SANS, 12));
}
コード例 #3
0
ファイル: CSG.cpp プロジェクト: BielBdeLuna/DarkRadiant
void mergeSelectedBrushes(const cmd::ArgumentList& args)
{
	// Get the current selection
	BrushPtrVector brushes = selection::algorithm::getSelectedBrushes();

	if (brushes.empty()) {
		rMessage() << _("CSG Merge: No brushes selected.") << std::endl;
		wxutil::Messagebox::ShowError(_("CSG Merge: No brushes selected."));
		return;
	}

	if (brushes.size() < 2) {
		rMessage() << "CSG Merge: At least two brushes have to be selected.\n";
		wxutil::Messagebox::ShowError("CSG Merge: At least two brushes have to be selected.");
		return;
	}

	rMessage() << "CSG Merge: Merging " << brushes.size() << " brushes." << std::endl;

	UndoableCommand undo("mergeSelectedBrushes");

	// Take the last selected node as reference for layers and parent
	scene::INodePtr merged = GlobalSelectionSystem().ultimateSelected();

	scene::INodePtr parent = merged->getParent();
	assert(parent != NULL);

	// Create a new BrushNode
	scene::INodePtr node = GlobalBrushCreator().createBrush();

	// Insert the newly created brush into the (same) parent entity
	parent->addChildNode(node);

	// Move the new brush to the same layers as the merged one
	node->assignToLayers(merged->getLayers());

	// Get the contained brush
	Brush* brush = Node_getBrush(node);

	// Attempt to merge the selected brushes into the new one
	if (!Brush_merge(*brush, brushes, true))
	{
		rWarning() << "CSG Merge: Failed - result would not be convex." << std::endl;
		return;
	}

	ASSERT_MESSAGE(!brush->empty(), "brush left with no faces after merge");

	// Remove the original brushes
	for (BrushPtrVector::iterator i = brushes.begin(); i != brushes.end(); ++i)
	{
		scene::removeNodeFromParent(*i);
	}

	// Select the new brush
	Node_setSelected(node, true);

	rMessage() << "CSG Merge: Succeeded." << std::endl;
	SceneChangeNotify();
}
コード例 #4
0
ファイル: UndoSystem.cpp プロジェクト: stiffsen/DarkRadiant
    void redo() {
        if (_redoStack.empty()) {
            rMessage() << "Redo: no redo available" << std::endl;
        }
        else {
            Operation* operation = _redoStack.back();
            rMessage() << "Redo: " << operation->_command << std::endl;

            startUndo();
            trackersRedo();
            operation->_snapshot.restore();
            finishUndo(operation->_command);
            _redoStack.pop_back();

            for (Observers::iterator i = _observers.begin(); i != _observers.end(); /* in-loop */) {
                Observer* observer = *(i++);
                observer->postRedo();
            }

            // Trigger the onPostUndo event on all scene nodes
            PostRedoWalker walker;
            GlobalSceneGraph().root()->traverse(walker);

            GlobalSceneGraph().sceneChanged();
        }
    }
コード例 #5
0
void Doom3FileSystem::initPakFile(ArchiveLoader& archiveModule, const std::string& filename)
{
    std::string fileExt(os::getExtension(filename));
    boost::to_lower(fileExt);

    if (_allowedExtensions.find(fileExt) != _allowedExtensions.end())
    {
        // Matched extension for archive (e.g. "pk3", "pk4")
        ArchiveDescriptor entry;

        entry.name = filename;
        entry.archive = archiveModule.openArchive(filename);
        entry.is_pakfile = true;
        _archives.push_back(entry);

        rMessage() << "[vfs] pak file: " << filename << std::endl;
    }
    else if (_allowedExtensionsDir.find(fileExt) != _allowedExtensionsDir.end())
    {
        // Matched extension for archive dir (e.g. "pk3dir", "pk4dir")
        ArchiveDescriptor entry;

        std::string path = os::standardPathWithSlash(filename);
        entry.name = path;
        entry.archive = DirectoryArchivePtr(new DirectoryArchive(path));
        entry.is_pakfile = false;
        _archives.push_back(entry);

        rMessage() << "[vfs] pak dir:  " << path << std::endl;
    }
}
コード例 #6
0
void nudgeSelectedCmd(const cmd::ArgumentList& args)
{
	if (args.size() != 1)
	{
		rMessage() << "Usage: nudgeSelected [up|down|left|right]" << std::endl;
		return;
	}

	UndoableCommand undo("nudgeSelected");

	std::string arg = boost::algorithm::to_lower_copy(args[0].getString());

	if (arg == "up") {
		nudgeSelected(eNudgeUp);
	}
	else if (arg == "down") {
		nudgeSelected(eNudgeDown);
	}
	else if (arg == "left") {
		nudgeSelected(eNudgeLeft);
	}
	else if (arg == "right") {
		nudgeSelected(eNudgeRight);
	}
	else {
		// Invalid argument
		rMessage() << "Usage: nudgeSelected [up|down|left|right]" << std::endl;
		return;
	}
}
コード例 #7
0
void MouseEventManager::loadXYViewEventDefinitions() {

	xml::NodeList xyviews = GlobalRegistry().findXPath("user/ui/input//xyview");

	if (!xyviews.empty())
	{
		// Find all the xy view definitions
		xml::NodeList eventList = xyviews[0].getNamedChildren("event");

		if (!eventList.empty())
		{
			rMessage() << "MouseEventManager: XYView Definitions found: "
								 << eventList.size() << std::endl;

			for (std::size_t i = 0; i < eventList.size(); i++)
			{
				// Get the event name
				const std::string eventName = eventList[i].getAttributeValue("name");

				// Check if any recognised event names are found and construct the according condition.
				if (eventName == "MoveView") {
					_xyConditions[ui::xyMoveView] = getCondition(eventList[i]);
				}
				else if (eventName == "Select") {
					_xyConditions[ui::xySelect] = getCondition(eventList[i]);
				}
				else if (eventName == "Zoom") {
					_xyConditions[ui::xyZoom] = getCondition(eventList[i]);
				}
				else if (eventName == "CameraMove") {
					_xyConditions[ui::xyCameraMove] = getCondition(eventList[i]);
				}
				else if (eventName == "CameraAngle") {
					_xyConditions[ui::xyCameraAngle] = getCondition(eventList[i]);
				}
				else if (eventName == "NewBrushDrag") {
					_xyConditions[ui::xyNewBrushDrag] = getCondition(eventList[i]);
				}
				else {
					rMessage() << "MouseEventManager: Warning: Ignoring unkown event name: " << eventName << std::endl;
				}
			}
		}
		else {
			// No event definitions found!
			rMessage() << "MouseEventManager: Critical: No XYView event definitions found!\n";
		}
	}
	else {
		// No event definitions found!
		rMessage() << "MouseEventManager: Critical: No XYView event definitions found!\n";
	}
}
コード例 #8
0
ファイル: ProcFile.cpp プロジェクト: BielBdeLuna/DarkRadiant
void ProcFile::saveToFile(const std::string& path)
{
	// write the file
	rMessage() << "----- WriteOutputFile -----" << std::endl;

	rMessage() << "writing " << path << std::endl;

	std::ofstream str(path.c_str());

	if (!str.good())
	{
		rMessage() << "error opening " << path << std::endl;
		return;
	}

	str << FILE_ID << std::endl << std::endl;

	// write the entity models and information, writing entities first
	for (ProcEntities::reverse_iterator i = entities.rbegin(); i != entities.rend(); ++i)
	{
		ProcEntity& entity = **i;
	
		if (entity.primitives.empty())
		{
			continue;
		}

		writeProcEntity(str, entity);
	}

	// write the shadow volumes
	for (std::size_t i = 0 ; i < lights.size(); ++i)
	{
		ProcLight& light = lights[i];

		if (light.shadowTris.vertices.empty())
		{
			continue;
		}

		str << (boost::format("shadowModel { /* name = */ \"_prelight_%s\"") % light.name) << std::endl << std::endl;

		writeShadowTriangles(str, light.shadowTris);

		str << "}" << std::endl << std::endl;
	}

	str.flush();
	str.close();
}
コード例 #9
0
void Doom3FileSystem::initialise()
{
    rMessage() << "filesystem initialised" << std::endl;

    std::string extensions = GlobalGameManager().currentGame()->getKeyValue("archivetypes");
    boost::algorithm::split(_allowedExtensions, extensions, boost::algorithm::is_any_of(" "));

    // Build list of dir extensions, e.g. pk4 -> pk4dir
    for (std::set<std::string>::const_iterator i = _allowedExtensions.begin();
         i != _allowedExtensions.end();
         ++i)
    {
        std::string extDir = *i + "dir";
        _allowedExtensionsDir.insert(extDir);
    }

    // Get the VFS search paths from the game manager
    const game::IGameManager::PathList& paths =
        GlobalGameManager().getVFSSearchPaths();

    // Initialise the paths, in the given order
    for (game::IGameManager::PathList::const_iterator i = paths.begin();
         i != paths.end(); i++)
    {
        initDirectory(*i);
    }

    for (ObserverList::iterator i = _observers.begin(); i != _observers.end(); ++i)
    {
        (*i)->onFileSystemInitialise();
    }
}
コード例 #10
0
ファイル: plugin.cpp プロジェクト: OpenTechEngine/DarkRadiant
	virtual void initialiseModule(const ApplicationContext& ctx)
	{
		rMessage() << getName() << "::initialiseModule called." << std::endl;

		// Associated "def_head" with an empty property editor instance
		GlobalEntityInspector().registerPropertyEditor(
			ui::DEF_HEAD_KEY, ui::IPropertyEditorPtr(new ui::AIHeadPropertyEditor())
		);

		GlobalEntityInspector().registerPropertyEditor(
			ui::DEF_VOCAL_SET_KEY, ui::IPropertyEditorPtr(new ui::AIVocalSetPropertyEditor())
		);

		GlobalCommandSystem().addCommand("FixupMapDialog", ui::FixupMapDialog::RunDialog);
		GlobalEventManager().addCommand("FixupMapDialog", "FixupMapDialog");

		GlobalUIManager().getMenuManager().add("main/map",
			"FixupMapDialog", ui::menuItem,
			_("Fixup Map..."), // caption
			"", // icon
			"FixupMapDialog"
		);

		GlobalRadiant().signal_radiantStarted().connect(
			sigc::ptr_fun(ui::AIEditingPanel::onRadiantStartup)
		);	
	}
コード例 #11
0
void LanguageManager::initFromContext(const ApplicationContext& ctx)
{
	// Initialise these members
	_languageSettingFile = ctx.getSettingsPath() + LANGUAGE_SETTING_FILE;
	_curLanguage = loadLanguageSetting();

	rMessage() << "Current language setting: " << _curLanguage << std::endl;

    // No handling of POSIX needed, since we don't use the LanguageManager on
    // POSIX
	_i18nPath = os::standardPathWithSlash(
        ctx.getApplicationPath() + "i18n"
    );

    // Set the LANG environment. As GLIB/GTK+ (in Win32) is using its own C
    // runtime, we need to call their GLIB setenv function for the environment
    // variable to take effect.
	g_setenv("LANG", _curLanguage.c_str(), TRUE);

	// Tell glib to load stuff from the given i18n path
	bindtextdomain(GETTEXT_PACKAGE, _i18nPath.c_str());

    // set encoding to utf-8 to prevent errors for Windows
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
}
コード例 #12
0
ファイル: GlyphSet.cpp プロジェクト: codereader/DarkRadiant
GlyphSetPtr GlyphSet::createFromDatFile(const std::string& vfsPath,
										const std::string& fontname,
										const std::string& language,
										Resolution resolution)
{
	ArchiveFilePtr file = GlobalFileSystem().openFile(vfsPath);

	// Check file size
	if (file->size() != sizeof(q3font::Q3FontInfo))
	{
		rWarning() << "FontLoader: invalid file size of file "
			<< vfsPath << ", expected " << sizeof(q3font::Q3FontInfo)
			<< ", found " << file->size() << std::endl;
		return GlyphSetPtr();
	}

	// Allocate a buffer with the Quake3 info structure
	q3font::Q3FontInfoPtr buf(new q3font::Q3FontInfo);

	InputStream& stream = file->getInputStream();
	stream.read(
		reinterpret_cast<StreamBase::byte_type*>(buf.get()),
		sizeof(q3font::Q3FontInfo)
	);

	// Construct a glyph set using the loaded info
	GlyphSetPtr glyphSet(new GlyphSet(*buf, fontname, language, resolution));

	rMessage() << "FontLoader: "  << vfsPath << " loaded successfully." << std::endl;

	return glyphSet;
}
コード例 #13
0
ファイル: UIManager.cpp プロジェクト: DerSaidin/DarkRadiant
void UIManager::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << "UIManager::initialiseModule called" << std::endl;

	_dialogManager = DialogManagerPtr(new DialogManager);

	_menuManager.loadFromRegistry();
	_toolbarManager.initialise();
	ColourSchemeManager::Instance().loadColourSchemes();

	GlobalCommandSystem().addCommand("EditColourScheme", ColourSchemeEditor::editColourSchemes);
	GlobalEventManager().addCommand("EditColourScheme", "EditColourScheme");

	GlobalRadiant().signal_radiantShutdown().connect(
        sigc::mem_fun(this, &UIManager::clear)
    );

	// Add the statusbar command text item
	_statusBarManager.addTextElement(
		STATUSBAR_COMMAND,
		"",  // no icon
		IStatusBarManager::POS_COMMAND
	);

    addLocalBitmapsAsIconFactory();
}
コード例 #14
0
ファイル: plugin.cpp プロジェクト: BielBdeLuna/DarkRadiant
void PicoPrintFunc( int level, const char *str )
{
	if( str == 0 )
		return;
	switch( level )
	{
		case PICO_NORMAL:
			rMessage() << str << "\n";
			break;

		case PICO_VERBOSE:
			//rMessage() << "PICO_VERBOSE: " << str << "\n";
			break;

		case PICO_WARNING:
			rError() << "PICO_WARNING: " << str << "\n";
			break;

		case PICO_ERROR:
			rError() << "PICO_ERROR: " << str << "\n";
			break;

		case PICO_FATAL:
			rError() << "PICO_FATAL: " << str << "\n";
			break;
	}
}
コード例 #15
0
/// brief Returns the filename of the executable belonging to the current process, or 0 if not found.
char* getexename(char *buf, char* argv[]) {
	/* Now read the symbolic link */
	int ret = readlink(LINK_NAME, buf, PATH_MAX);

	if (ret == -1) {
		rMessage() << "getexename: falling back to argv[0]: '" << argv[0] << "'";
		const char* path = realpath(argv[0], buf);
		if (path == NULL) {
			/* In case of an error, leave the handling up to the caller */
			return "";
		}
	}

	/* Ensure proper NUL termination */
	buf[ret] = 0;

	/* delete the program name */
	*(strrchr(buf, '/')) = '\0';

	// NOTE: we build app path with a trailing '/'
	// it's a general convention in Radiant to have the slash at the end of directories
	if (buf[strlen(buf)-1] != '/') {
		strcat(buf, "/");
	}

	return buf;
}
コード例 #16
0
// Loads the default shortcuts from the registry
void EventManager::loadAccelerators() {
	if (_debugMode) {
		std::cout << "EventManager: Loading accelerators...\n";
	}

	xml::NodeList shortcutSets = GlobalRegistry().findXPath("user/ui/input//shortcuts");

	if (_debugMode) {
		std::cout << "Found " << shortcutSets.size() << " sets.\n";
	}

	// If we have two sets of shortcuts, delete the default ones
	if (shortcutSets.size() > 1) {
		GlobalRegistry().deleteXPath("user/ui/input//shortcuts[@name='default']");
	}

	// Find all accelerators
	xml::NodeList shortcutList = GlobalRegistry().findXPath("user/ui/input/shortcuts//shortcut");

	if (shortcutList.size() > 0) {
		rMessage() << "EventManager: Shortcuts found in Registry: " <<
			static_cast<int>(shortcutList.size()) << std::endl;
		for (unsigned int i = 0; i < shortcutList.size(); i++) {
			const std::string key = shortcutList[i].getAttributeValue("key");

			if (_debugMode) {
				std::cout << "Looking up command: " << shortcutList[i].getAttributeValue("command") << "\n";
				std::cout << "Key is: >> " << key << " << \n";
			}

			// Try to lookup the command
			IEventPtr event = findEvent(shortcutList[i].getAttributeValue("command"));

			// Check for a non-empty key string
			if (key != "") {
				 // Check for valid command definitions were found
				if (!event->empty()) {
					// Get the modifier string (e.g. "SHIFT+ALT")
					const std::string modifierStr = shortcutList[i].getAttributeValue("modifiers");

					if (!duplicateAccelerator(key, modifierStr, event)) {
						// Create the accelerator object
						IAccelerator& accelerator = addAccelerator(key, modifierStr);

						// Connect the newly created accelerator to the command
						accelerator.connectEvent(event);
					}
				}
				else {
					rWarning() << "EventManager: Cannot load shortcut definition (command invalid)."
						<< std::endl;
				}
			}
		}
	}
	else {
		// No accelerator definitions found!
		rWarning() << "EventManager: No shortcut definitions found..." << std::endl;
	}
}
コード例 #17
0
// Initialise all registered modules
void ModuleRegistry::loadAndInitialiseModules()
{
	if (_modulesInitialised)
    {
		throw std::runtime_error("ModuleRegistry::initialiseModule called twice.");
	}

	_sigModuleInitialisationProgress.emit(_("Searching for Modules"), 0.0f);

	rMessage() << "ModuleRegistry Compatibility Level is " << getCompatibilityLevel() << std::endl;

	// Invoke the ModuleLoad routine to load the DLLs from modules/ and plugins/
	_loader.loadModules(_context->getLibraryPath());

	_progress = 0.1f;
	_sigModuleInitialisationProgress.emit(_("Initialising Modules"), _progress);

	for (ModulesMap::iterator i = _uninitialisedModules.begin();
		 i != _uninitialisedModules.end(); ++i)
	{
		// greebo: Dive into the recursion
		// (this will return immediately if the module is already initialised).
		initialiseModuleRecursive(i->first);
	}

	// Make sure this isn't called again
	_modulesInitialised = true;

    _progress = 1.0f;
	_sigModuleInitialisationProgress.emit(_("Modules initialised"), _progress);

	// Fire the signal now, this will destroy the Splash dialog as well
	_sigAllModulesInitialised.emit();
}
コード例 #18
0
ファイル: SoundPlayer.cpp プロジェクト: DerSaidin/DarkRadiant
void SoundPlayer::initialise() {
	// Create device
	ALCdevice* device = alcOpenDevice(NULL);

	if (device != NULL) {
		// Create context
		_context = alcCreateContext(device, NULL);

		if (_context != NULL) {
			// Make context current
			if (!alcMakeContextCurrent(_context)) {
				alcDestroyContext(_context);
				alcCloseDevice(device);
				_context = NULL;

				rError() << "Could not make ALC context current." << std::endl;
			}

			// Success
			_initialised = true;
			rMessage() << "SoundPlayer: OpenAL context successfully set up." << std::endl;
		}
		else {
			alcCloseDevice(device);
			rError() << "Could not create ALC context." << std::endl;
		}
	}
	else {
		rError() << "Could not open ALC device." << std::endl;
    }
}
コード例 #19
0
void LanguageManager::findAvailableLanguages()
{
	// English (index 0) is always available
	_availableLanguages.push_back(0);

	wxFileTranslationsLoader loader;
	wxArrayString translations = loader.GetAvailableTranslations(GETTEXT_PACKAGE);

	std::for_each(translations.begin(), translations.end(), [&] (const wxString& lang)
	{
		// Get the index (is this a known language?)
		try
		{
			int index = getLanguageIndex(lang.ToStdString());

			// Add this to the list (could use more extensive checking, but this is enough for now)
			_availableLanguages.push_back(index);
		}
		catch (UnknownLanguageException&)
		{
			rWarning() << "Skipping unknown language: " << lang << std::endl;
		}
	});

	rMessage() << "Found " << _availableLanguages.size() << " language folders." << std::endl;
}
コード例 #20
0
ファイル: rsdpa_lib.cpp プロジェクト: sourekj/Packages
void rSdpaLib::inputCMat(int l, int i, int j, double value)
{
  l--;
  if (l<0 || l>=nBlock) {
    rMessage("Over nBlock of C:: " << l+1);
    rError("nBlock of C :: " << nBlock);
  }
  i--;
  j--;
  int size = blockStruct[l];
  rSparseMatrix& target = C.ele[l];
  int count = target.NonZeroCount;
  if (target.Sp_De_Di == rSparseMatrix::SPARSE
      && count >= target.NonZeroNumber) {
    rError("C.ele[" << (l+1) << "]"
	   << " is too much element which is assigned");
  }
  if (size>0) {
    target.row_index[count] = i;
    target.column_index[count] = j;
    target.sp_ele[count] = value;
    target.NonZeroCount++;
    if (i==j) {
      target.NonZeroEffect++;
    } else {
      target.NonZeroEffect += 2;
    }
  } else {
    target.di_ele[j] = value;
  }
}
コード例 #21
0
void RadiantSelectionSystem::initialiseModule(const ApplicationContext& ctx) 
{
    rMessage() << "RadiantSelectionSystem::initialiseModule called.\n";

    constructStatic();

    SetManipulatorMode(eTranslate);
    pivotChanged();

    _sigSelectionChanged.connect(
        sigc::mem_fun(this, &RadiantSelectionSystem::pivotChangedSelection)
    );

    GlobalGrid().signal_gridChanged().connect(
        sigc::mem_fun(this, &RadiantSelectionSystem::pivotChanged)
    );

    GlobalRegistry().signalForKey(RKEY_ROTATION_PIVOT).connect(
        sigc::mem_fun(this, &RadiantSelectionSystem::keyChanged)
    );

    // Pass a reference to self to the global event manager
    GlobalEventManager().connectSelectionSystem(this);

    // Connect the bounds changed caller
    GlobalSceneGraph().signal_boundsChanged().connect(
        sigc::mem_fun(this, &RadiantSelectionSystem::onSceneBoundsChanged)
    );

    GlobalRenderSystem().attachRenderable(*this);
}
コード例 #22
0
void Doom3MapCompiler::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << getName() << ": initialiseModule called." << std::endl;

	GlobalCommandSystem().addCommand("dmap", boost::bind(&Doom3MapCompiler::dmapCmd, this, _1), cmd::ARGTYPE_STRING);
	GlobalCommandSystem().addCommand("setDmapRenderOption", boost::bind(&Doom3MapCompiler::setDmapRenderOption, this, _1), cmd::ARGTYPE_INT);
}
コード例 #23
0
void MouseEventManager::loadCameraStrafeDefinitions()
{
	// Find all the camera strafe definitions
	xml::NodeList strafeList = GlobalRegistry().findXPath("user/ui/input/cameraview/strafemode");

	if (!strafeList.empty())
	{
		// Get the strafe condition flags
		_toggleStrafeCondition.modifierFlags = _modifiers.getModifierFlags(strafeList[0].getAttributeValue("toggle"));
		_toggleForwardStrafeCondition.modifierFlags = _modifiers.getModifierFlags(strafeList[0].getAttributeValue("forward"));

		try {
			_strafeSpeed = boost::lexical_cast<float>(strafeList[0].getAttributeValue("speed"));
		}
		catch (boost::bad_lexical_cast e) {
			_strafeSpeed = DEFAULT_STRAFE_SPEED;
		}

		try {
			_forwardStrafeFactor = boost::lexical_cast<float>(strafeList[0].getAttributeValue("forwardFactor"));
		}
		catch (boost::bad_lexical_cast e) {
			_forwardStrafeFactor = 1.0f;
		}
	}
	else {
		// No Camera strafe definitions found!
		rMessage() << "MouseEventManager: Critical: No camera strafe definitions found!\n";
	}
}
コード例 #24
0
void ScriptingSystem::shutdownModule()
{
	rMessage() << getName() << "::shutdownModule called." << std::endl;

	_scriptMenu.reset();

	_initialised = false;

	// Clear the buffer so that nodes finally get destructed
	SceneNodeBuffer::Instance().clear();

	_commands.clear();

	_scriptPath.clear();

	// Free all interfaces
	_interfaces.clear();

	PythonModule::Clear();

	// The finalize_interpreter() function is not available in older versions
#ifdef DR_PYBIND_HAS_EMBED_H
	py::finalize_interpreter();
#else 
	Py_Finalize();
#endif
}
コード例 #25
0
void Doom3ShaderSystem::loadMaterialFiles()
{
	// Get the shaders path and extension from the XML game file
	xml::NodeList nlShaderPath =
		GlobalGameManager().currentGame()->getLocalXPath("/filesystem/shaders/basepath");
	if (nlShaderPath.empty())
		throw xml::MissingXMLNodeException(MISSING_BASEPATH_NODE);

	xml::NodeList nlShaderExt =
		GlobalGameManager().currentGame()->getLocalXPath("/filesystem/shaders/extension");
	if (nlShaderExt.empty())
		throw xml::MissingXMLNodeException(MISSING_EXTENSION_NODE);

	// Load the shader files from the VFS
	std::string sPath = nlShaderPath[0].getContent();
	if (!boost::algorithm::ends_with(sPath, "/"))
		sPath += "/";

	std::string extension = nlShaderExt[0].getContent();

	// Load each file from the global filesystem
	ShaderFileLoader loader(sPath, _currentOperation);
	{
		ScopedDebugTimer timer("ShaderFiles parsed: ");
        GlobalFileSystem().forEachFile(sPath, extension, [&](const std::string& filename)
        {
            loader.addFile(filename);
        }, 0);
		loader.parseFiles();
	}

	rMessage() << _library->getNumShaders() << " shaders found." << std::endl;
}
コード例 #26
0
ファイル: MapPosition.cpp プロジェクト: DerSaidin/DarkRadiant
void MapPosition::recall(const cmd::ArgumentList& args) {
    if (!empty()) {
        rMessage() << "Restoring map position #" << _index << std::endl;
        // Focus the view with the default angle
        Map::focusViews(_position, _angle);
    }
}
コード例 #27
0
void Doom3ShaderSystem::shutdownModule()
{
	rMessage() << "Doom3ShaderSystem::shutdownModule called\n";

	destroy();
	unrealise();
}
コード例 #28
0
void EClassManager::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << "EntityClassDoom3::initialiseModule called." << std::endl;

	GlobalFileSystem().addObserver(*this);
	realise();
}
コード例 #29
0
ファイル: Clipper.cpp プロジェクト: DerSaidin/DarkRadiant
void Clipper::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << "Clipper::initialiseModule called\n";

	_useCaulk = registry::getValue<bool>(RKEY_CLIPPER_USE_CAULK);
	_caulkShader = GlobalRegistry().get(RKEY_CLIPPER_CAULK_SHADER);

	GlobalRegistry().signalForKey(RKEY_CLIPPER_USE_CAULK).connect(
        sigc::mem_fun(this, &Clipper::keyChanged)
    );
	GlobalRegistry().signalForKey(RKEY_CLIPPER_CAULK_SHADER).connect(
        sigc::mem_fun(this, &Clipper::keyChanged)
    );

	constructPreferences();

	// Register the clip commands
	GlobalCommandSystem().addCommand("ClipSelected", boost::bind(&Clipper::clipSelectionCmd, this, _1));
	GlobalCommandSystem().addCommand("SplitSelected", boost::bind(&Clipper::splitSelectedCmd, this, _1));
	GlobalCommandSystem().addCommand("FlipClip", boost::bind(&Clipper::flipClipperCmd, this, _1));

	// Connect some events to these commands
	GlobalEventManager().addCommand("ClipSelected", "ClipSelected");
	GlobalEventManager().addCommand("SplitSelected", "SplitSelected");
	GlobalEventManager().addCommand("FlipClip", "FlipClip");
}
コード例 #30
0
void Doom3MapCompiler::generateProc(const scene::INodePtr& root)
{
	rMessage() << "=== DMAP: GenerateProc ===" << std::endl;

	ProcCompiler compiler(root);

	_procFile = compiler.generateProcFile();
}