void DotSceneLoader::processFog(rapidxml::xml_node<>* XMLNode)
{
	// Process attributes
	Ogre::Real expDensity = getAttribReal(XMLNode, "density", 0.001);
	Ogre::Real linearStart = getAttribReal(XMLNode, "start", 0.0);
	Ogre::Real linearEnd = getAttribReal(XMLNode, "end", 1.0);

	Ogre::FogMode mode = Ogre::FOG_NONE;
	Ogre::String sMode = getAttrib(XMLNode, "mode");
	if (sMode == "none")
		mode = Ogre::FOG_NONE;
	else if (sMode == "exp")
		mode = Ogre::FOG_EXP;
	else if (sMode == "exp2")
		mode = Ogre::FOG_EXP2;
	else if (sMode == "linear")
		mode = Ogre::FOG_LINEAR;
	else
		mode = (Ogre::FogMode)Ogre::StringConverter::parseInt(sMode);

	rapidxml::xml_node<>* pElement;

	// Process colourDiffuse (?)
	Ogre::ColourValue colourDiffuse = Ogre::ColourValue::White;
	pElement = XMLNode->first_node("colour");
	if (pElement)
		colourDiffuse = parseColour(pElement);

	// Setup the fog
	mSceneMgr->setFog(mode, colourDiffuse, expDensity, linearStart, linearEnd);
}
Esempio n. 2
0
void DotSceneLoader::processFog(TiXmlElement *xmlNode) {
#if 0
	// Process attributes
	float expDensity = getAttribReal(xmlNode, "expDensity", 0.001);
	float linearStart = getAttribReal(xmlNode, "linearStart", 0.0);
	float linearEnd = getAttribReal(xmlNode, "linearEnd", 1.0);

	FogMode mode = FOG_NONE;
	std::string sMode = getAttrib(xmlNode, "mode");
	if(sMode == "none")
	mode = FOG_NONE;
	else if(sMode == "exp")
	mode = FOG_EXP;
	else if(sMode == "exp2")
	mode = FOG_EXP2;
	else if(sMode == "linear")
	mode = FOG_LINEAR;

	TiXmlElement *pElement;

	// Process colourDiffuse (?)
	math::Vector3 colourDiffuse = math::Vector3::White;
	pElement = xmlNode->FirstChildElement("colourDiffuse");
	if(pElement)
	colourDiffuse = parseColour(pElement);

	// Setup the fog
	sceneManager->setFog(mode, colourDiffuse, expDensity, linearStart, linearEnd);
#endif
}
Esempio n. 3
0
bool getElement(const TiXmlElement* XMLNode, const gkString& name, gkColor &c)
{
	const TiXmlElement* pElement = XMLNode->FirstChildElement(name);
	if (!pElement) return false;
	
	c = parseColour(pElement);
	return true;
}
Esempio n. 4
0
bool Mal4sLog::parseCommitEntry(RCommit& commit) {

    std::string line;
    std::vector<std::string> entries;

    if(!getNextLine(line)) return false;

    //custom line
    if(!mal4s_regex.match(line, &entries)) return false;

    long timestamp       = atol(entries[0].c_str());

    std::string username = (entries[1].size()>0) ? entries[1] : "Unknown";
    std::string action   = (entries[2].size()>0) ? entries[2] : "A";

    //if this file is for the same person and timestamp
    //we add to the commit, else we save the lastline
    //and return false
    if(commit.files.empty()) {
        commit.timestamp = timestamp;
        commit.username  = username;
    } else {
        if(commit.timestamp != timestamp || commit.username  != username) {
            lastline = line;
            return false;
        }
    }

    if(entries.size()>=6 && entries[5].size()>0) {
	commit.userimagename = entries[5];
    } else commit.userimagename = commit.username;

    std::vector<std::string> displayData;

    //Extra fields for display on hover.
    if(entries.size()>=7 ) {
	displayData = split(entries[6], '|');
    }

    bool has_colour = false;
    vec3 colour;

    if(entries.size()>=5 && entries[4].size()>0) {
        has_colour = true;
        colour = parseColour(entries[4]);
    }

    if(has_colour) {
        commit.addFile(entries[3], action, colour, commit.username, commit.userimagename, displayData);
    } else {
        commit.addFile(entries[3], action, commit.username, commit.userimagename, displayData);
    }

    return true;
}
void DotSceneLoader::processEnvironment(rapidxml::xml_node<>* XMLNode)
{
	rapidxml::xml_node<>* pElement;

	// Process camera (?)
	pElement = XMLNode->first_node("camera");
	if (pElement)
		processCamera(pElement);

	// Process fog (?)
	pElement = XMLNode->first_node("fog");
	if (pElement)
		processFog(pElement);

	// Process skyBox (?)
	pElement = XMLNode->first_node("skyBox");
	if (pElement)
		processSkyBox(pElement);

	// Process skyDome (?)
	pElement = XMLNode->first_node("skyDome");
	if (pElement)
		processSkyDome(pElement);

	// Process skyPlane (?)
	pElement = XMLNode->first_node("skyPlane");
	if (pElement)
		processSkyPlane(pElement);

	// Process clipping (?)
	pElement = XMLNode->first_node("clipping");
	if (pElement)
		processClipping(pElement);

	// Process colourAmbient (?)
	pElement = XMLNode->first_node("colourAmbient");
	if (pElement)
		mSceneMgr->setAmbientLight(parseColour(pElement));

	// Process colourBackground (?)
	//! @todo Set the background colour of all viewports (RenderWindow has to be provided then)
	pElement = XMLNode->first_node("colourBackground");
	if (pElement)
		;//mSceneMgr->set(parseColour(pElement));

	// Process userDataReference (?)
	pElement = XMLNode->first_node("userDataReference");
	if (pElement)
		processUserDataReference(pElement);
}
Esempio n. 6
0
bool CustomLog::readCustomCommit(RCommit& commit) {

    std::string line;
    std::vector<std::string> entries;

    if(!getNextLine(line)) return false;

    //custom line
    if(!custom_regex.match(line, &entries)) return false;

    long timestamp       = atol(entries[0].c_str());

    std::string username = (entries[1].size()>0) ? entries[1] : "Unknown";
    std::string action   = (entries[2].size()>0) ? entries[2] : "A";

    bool has_colour = false;
    vec3f colour;

    if(entries.size()>=5 && entries[4].size()>0) {
        has_colour = true;
        colour = parseColour(entries[4]);
    }

    //if this file is for the same person and timestamp
    //we add to the commit, else we save the lastline
    //and return false
    if(commit.files.size() > 0
       && (commit.timestamp != timestamp
           || commit.username  != username)) {
        lastline = line;
        return false;
    }

    if(commit.files.size() == 0) {
        commit.timestamp = timestamp;
        commit.username  = username;
    }

    if(has_colour) {
        commit.addFile(entries[3], action, colour);
    } else {
        commit.addFile(entries[3], action);
    }

    return true;
}
Esempio n. 7
0
void DotSceneLoader::processEnvironment(rapidxml::xml_node<>* XMLNode) {
	rapidxml::xml_node<>* pElement;

	// Process camera (?)
	pElement = XMLNode->first_node("camera");
	if (pElement)
		processCamera(pElement);

	// Process fog (?)
	pElement = XMLNode->first_node("fog");
	if (pElement)
		processFog(pElement);

	// Process skyBox (?)
	pElement = XMLNode->first_node("skyBox");
	if (pElement)
		processSkyBox(pElement);

	// Process skyDome (?)
	pElement = XMLNode->first_node("skyDome");
	if (pElement)
		processSkyDome(pElement);

	// Process skyPlane (?)
	pElement = XMLNode->first_node("skyPlane");
	if (pElement)
		processSkyPlane(pElement);

	// Process clipping (?)
	pElement = XMLNode->first_node("clipping");

	// Process colourAmbient (?)
	pElement = XMLNode->first_node("colourAmbient");
	if (pElement)
		mSceneMgr->setAmbientLight(parseColour(pElement));

	// Process colourBackground (?)
	pElement = XMLNode->first_node("colourBackground");
	/*
	if (pElement)
		;// mSceneMgr->set(parseColour(pElement));
	 */
	// Process userDataReference (?)
	pElement = XMLNode->first_node("userDataReference");
}
Esempio n. 8
0
bool CustomLog::parseCommit(RCommit& commit) {

    std::string line;
    std::vector<std::string> entries;

    if(!logf->getNextLine(line)) return false;

    //custom line
    if(!custom_regex.match(line, &entries)) return false;

    commit.timestamp = atol(entries[0].c_str());

    commit.username = entries[1];

    if(commit.username.size()==0) {
        commit.username = "******";
    }

    std::string action = "A";

    if(entries[2].size()>0) {
        action = entries[2];
    }

    bool has_colour = false;
    vec3f colour;

    if(entries.size()>=5 && entries[4].size()>0) {
        has_colour = true;
        colour = parseColour(entries[4]);
    }

//    debugLog("file = %s, timestamp=%d, username=%s, action=%s\n",  entries[3].c_str(), 
//        commit.timestamp, commit.username.c_str(), action.c_str());

    if(has_colour) {
        commit.addFile(entries[3], action, colour);
    } else {
        commit.addFile(entries[3], action);
    }

    //commit.debug();

    return true;
}
void DotSceneLoader::processLight(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
	// Process attributes
	Ogre::String name = getAttrib(XMLNode, "name");
	Ogre::String id = getAttrib(XMLNode, "id");

	// Create the light
	Ogre::Light *pLight = mSceneMgr->createLight(name);
	if (pParent)
		pParent->attachObject(pLight);

	Ogre::String sValue = getAttrib(XMLNode, "type");
	if (sValue == "point")
		pLight->setType(Ogre::Light::LT_POINT);
	else if (sValue == "directional")
		pLight->setType(Ogre::Light::LT_DIRECTIONAL);
	else if (sValue == "spot")
		pLight->setType(Ogre::Light::LT_SPOTLIGHT);
	else if (sValue == "radPoint")
		pLight->setType(Ogre::Light::LT_POINT);

	pLight->setVisible(getAttribBool(XMLNode, "visible", true));
	pLight->setCastShadows(getAttribBool(XMLNode, "castShadows", true));

	rapidxml::xml_node<>* pElement;

	// Process position (?)
	pElement = XMLNode->first_node("position");
	if (pElement)
		pLight->setPosition(parseVector3(pElement));

	// Process normal (?)
	pElement = XMLNode->first_node("normal");
	if (pElement)
		pLight->setDirection(parseVector3(pElement));

	pElement = XMLNode->first_node("directionVector");
	if (pElement)
	{
		pLight->setDirection(parseVector3(pElement));
		mLightDirection = parseVector3(pElement);
	}

	// Process colourDiffuse (?)
	pElement = XMLNode->first_node("colourDiffuse");
	if (pElement)
		pLight->setDiffuseColour(parseColour(pElement));

	// Process colourSpecular (?)
	pElement = XMLNode->first_node("colourSpecular");
	if (pElement)
		pLight->setSpecularColour(parseColour(pElement));

	if (sValue != "directional")
	{
		// Process lightRange (?)
		pElement = XMLNode->first_node("lightRange");
		if (pElement)
			processLightRange(pElement, pLight);

		// Process lightAttenuation (?)
		pElement = XMLNode->first_node("lightAttenuation");
		if (pElement)
			processLightAttenuation(pElement, pLight);
	}
	// Process userDataReference (?)
	pElement = XMLNode->first_node("userDataReference");
	if (pElement)
		;//processUserDataReference(pElement, pLight);
}
Esempio n. 10
0
void DotSceneLoader::processLight(TiXmlElement *xmlNode, Node *pParent) {
	// Process attributes
	std::string name = getAttrib(xmlNode, "name");
	std::string id = getAttrib(xmlNode, "id");
	std::string sValue = getAttrib(xmlNode, "type");

	Light* light = 0;

	if(sValue == "point") {
		light = scene->createPointLight();
	}
	//	else if(sValue == "directional")
	//		pLight->setType(Light::LT_DIRECTIONAL);
	//	else if(sValue == "spot")
	//		pLight->setType(Light::LT_SPOTLIGHT);
	//	else if(sValue == "radPoint")
	//		pLight->setType(Light::LT_POINT);

	// Create the light
	if(pParent) {
		//lightEntity->addComponent(new NodeAdapter(pParent));
	}

	//light->setVisible(getAttribBool(xmlNode, "visible", true));
	light->castShadow(getAttribBool(xmlNode, "castShadows", true));

	TiXmlElement *pElement;

	// Process position (?)
	pElement = xmlNode->FirstChildElement("position");
	if(pElement)
		light->setPosition(parseVector3(pElement));

	// Process normal (?)
	pElement = xmlNode->FirstChildElement("normal");
	if(pElement)
		light->setDirection(parseVector3(pElement));

	// Process colourDiffuse (?)
	pElement = xmlNode->FirstChildElement("colourDiffuse");
	if(pElement)
		light->setDiffuse(parseColour(pElement));

	// Process colourSpecular (?)
	pElement = xmlNode->FirstChildElement("colourSpecular");
	if(pElement)
		light->setSpecular(parseColour(pElement));

	// Process lightRange (?)
	pElement = xmlNode->FirstChildElement("lightRange");
	if(pElement)
		processLightRange(pElement, light);

	// Process lightAttenuation (?)
	pElement = xmlNode->FirstChildElement("lightAttenuation");
	if(pElement)
		processLightAttenuation(pElement, light);

	// Process userDataReference (?)
	pElement = xmlNode->FirstChildElement("userDataReference");
	if(pElement)
		; //processUserDataReference(pElement, pLight);

	//light->setAmbient(math::Vector3(0.5, 0.5, 0.5));
	//light->setDiffuse(math::Vector3(1.0, 1.0, 1.0));
	//light->setSpecular(math::Vector3(0.5, 0.5, 0.5));
	//light->setPosition(math::Vector3(0.0, 10.0, 0.0));
	//light->setAttenuations(math::Vector3(100.0, 1.0, 1.0));
	light->setDirection(math::Vector3(0.5, -1.0, 0.0).normalize());
	light->castShadow(true);
}