Пример #1
0
void UIAnimation::ParseLua(LuaObject& data)
{
	if (!data.IsValid())
		return;

	mID = data.GetField("id").GetInt(mID);
	mName = data.GetField("name").GetString();
	mLength = data.GetField("length").GetFloat();
	mLoop = data.GetField("loop").GetBoolWithDef(mLoop);
	auto textColor = data.GetField("TextColor");
	if (textColor.IsValid())
	{
		auto keys = textColor.GetField("keys");
		assert(keys.IsValid());
		auto it = keys.GetSequenceIterator();
		LuaObject v;
		while (it.GetNext(v))
		{
			auto time = v.GetField("time").GetFloat();
			auto color = v.GetField("color").GetVec4();
			AddTextColor(time, Color(color));
		}
	}

	auto backColor = data.GetField("BackColor");
	if (backColor.IsValid())
	{
		auto keys = backColor.GetField("keys");
		assert(keys.IsValid());
		auto it = keys.GetSequenceIterator();
		LuaObject v;
		while (it.GetNext(v))
		{
			auto time = v.GetField("time").GetFloat();
			auto color = v.GetField("color").GetVec4();
			AddBackColor(time, Color(color));
		}
	}

	auto posAnim = data.GetField("Pos");
	if (posAnim.IsValid())
	{
		auto keys = posAnim.GetField("keys");
		assert(keys.IsValid());
		auto it = keys.GetSequenceIterator();
		LuaObject v;
		while (it.GetNext(v))
		{
			auto time = v.GetField("time").GetFloat();
			auto pos = v.GetField("pos").GetVec2();
			AddPos(time, pos);
		}
	}
}
Пример #2
0
static void
addALine( /*lint -e{818} */ Occluder * pOcc, float x, float y, float z, float x2, float y2, float z2, float x3,
         float y3, float z3, int otherEdge)
{                               /* Declaring pOcc as constant isn't useful as pointer member is modified (error 818) */
    winged_edge we;
    int planeNum;
    unsigned int p1 = AddPos(pOcc->handle->points, x, y, z);
    unsigned int p2 = AddPos(pOcc->handle->points, x2, y2, z2);

    position pn3;
    pn3.x = x3;
    pn3.y = y3;
    pn3.z = z3;

    planeNum =
        (int) AddPlane(pOcc->handle->planes, &g_array_index(pOcc->handle->points, position, p1),
                       &g_array_index(pOcc->handle->points, position, p2), &pn3);

    we.e[0] = p1;
    we.e[1] = p2;
    we.w[0] = planeNum;
    we.w[1] = otherEdge;        /* subsequent attempt to add this edge will replace w[1] */
    AddEdge(pOcc->handle->edges, &we);
}
Пример #3
0
void Vessel::AddVelToPos()
{
	AddPos(m_Vel);
}
Пример #4
0
void UIAnimation::LoadFromXML(tinyxml2::XMLElement* elem)
{
	if (!elem)
		return;

	const char* sz = elem->Attribute("id");
	if (sz)
		mID = StringConverter::ParseInt(sz);

	sz = elem->Attribute("name");
	if (sz)
		mName = sz;

	sz = elem->Attribute("length");
	if (sz)
		mLength = StringConverter::ParseReal(sz);

	sz = elem->Attribute("loop");
	if (sz)
		mLoop = StringConverter::ParseBool(sz);

	{
		tinyxml2::XMLElement* pC = elem->FirstChildElement("TextColor");
		if (pC)
		{
			tinyxml2::XMLElement* k = pC->FirstChildElement("key");
			while (k)
			{
				float time = 0;
				Color color;
				sz = k->Attribute("time");
				if (sz)
					time = StringConverter::ParseReal(sz);
				sz = k->Attribute("color");
				if (sz)
					color = StringMathConverter::ParseColor(sz);
				AddTextColor(time, color);
				k = k->NextSiblingElement("key");
			}
		}
	}

	{
		tinyxml2::XMLElement* pC = elem->FirstChildElement("BackColor");
		if (pC)
		{
			tinyxml2::XMLElement* k = pC->FirstChildElement("key");
			while (k)
			{
				float time = 0;
				Color color;
				sz = k->Attribute("time");
				if (sz)
					time = StringConverter::ParseReal(sz);
				sz = k->Attribute("color");
				if (sz)
					color = StringMathConverter::ParseColor(sz);
				AddBackColor(time, color);
				k = k->NextSiblingElement("key");
			}
		}
	}

	{
		tinyxml2::XMLElement* pC = elem->FirstChildElement("MaterialColor");
		if (pC)
		{
			tinyxml2::XMLElement* k = pC->FirstChildElement("key");
			while (k)
			{
				float time = 0;
				Color color;
				sz = k->Attribute("time");
				if (sz)
					time = StringConverter::ParseReal(sz);
				sz = k->Attribute("color");
				if (sz)
					color = StringMathConverter::ParseColor(sz);
				AddMaterialColor(time, color);
				k = k->NextSiblingElement("key");
			}
		}
	}

	{
		tinyxml2::XMLElement* pC = elem->FirstChildElement("Pos");
		if (pC)
		{
			tinyxml2::XMLElement* k = pC->FirstChildElement("key");
			while (k)
			{
				float time = 0;
				Vec2 pos;
				sz = k->Attribute("time");
				if (sz)
					time = StringConverter::ParseReal(sz);
				sz = k->Attribute("pos");
				if (sz)
					pos = StringMathConverter::ParseVec2(sz);
				AddPos(time, pos);
				k = k->NextSiblingElement("key");
			}
		}
	}

	{
		tinyxml2::XMLElement* pC = elem->FirstChildElement("Scale");
		if (pC)
		{
			tinyxml2::XMLElement* k = pC->FirstChildElement("key");
			while (k)
			{
				float time = 0;
				Vec2 scale;
				sz = k->Attribute("time");
				if (sz)
					time = StringConverter::ParseReal(sz);
				sz = k->Attribute("scale");
				if (sz)
					scale = StringMathConverter::ParseVec2(sz);
				AddScale(time, scale);
				k = k->NextSiblingElement("key");
			}
		}
	}

	{
		tinyxml2::XMLElement* pC = elem->FirstChildElement("Alpha");
		if (pC)
		{
			tinyxml2::XMLElement* k = pC->FirstChildElement("key");
			while (k)
			{
				float time = 0;
				float alpha;
				sz = k->Attribute("time");
				if (sz)
					time = StringConverter::ParseReal(sz);
				sz = k->Attribute("alpha");
				if (sz)
					alpha = StringConverter::ParseReal(sz);
				AddAlpha(time, alpha);
				k = k->NextSiblingElement("key");
			}
		}
	}
}