Exemplo n.º 1
0
	void Material::ParseExp(MaterialExpression* inputexp,JsonObject& obj)
	{
		JsonObject::MemberIterator first_mem = obj.MemberBegin();
		s32 input_index = 0;
		while(first_mem!=obj.MemberEnd())
		{
			if (first_mem->value.IsObject())
			{
				MaterialExpMap::iterator it = exp_map_.find(first_mem->name.GetString());
				if (it!=exp_map_.end())
				{
					MaterialExpression* exp =(*it).second;
					MaterialInput* input = inputexp->GetInput(input_index);
					if (input)
					{
						input->input_mask_ = ParseMask(first_mem->value);
						input->link_= exp;
					}
					
					input_index++;
					ParseExp(exp,first_mem->value);
				}
			}
			
			first_mem++;
		}	
	}
Exemplo n.º 2
0
	void Material::LoadAllEXP(JsonObject& obj)
	{
		JsonObject::MemberIterator first_mem = obj.MemberBegin();
		while(first_mem!=obj.MemberEnd())
		{
			JsonObject& expjson = first_mem->value;
			MaterialExpression* exp = Object::CreateObject(first_mem->name.GetString())->DynamicCast<MaterialExpression>();
			string name ;
			GetValue<string>(name,expjson,"name");
			Assert(exp);
			exp->Parse(expjson);
			Assert(exp_map_.find(name)==exp_map_.end());
			exp_map_[name] = exp;
			first_mem ++;
		}
		
	}
Exemplo n.º 3
0
	void Material::ParseExp(MaterialInput& input,JsonObject& obj,const string& key)
	{
		if (obj.HasMember(key.c_str()))
		{
			JsonObject::MemberIterator first_mem = obj[key.c_str()].MemberBegin();
			if(first_mem!=obj.MemberEnd())
			{
				MaterialExpMap::iterator it = exp_map_.find(first_mem->name.GetString());
				if (it!=exp_map_.end())
				{
					MaterialExpression* exp =(*it).second;
					input.input_mask_ = ParseMask(first_mem->value);
					ParseExp(exp,first_mem->value);
					input.link_ = exp;
				}
				first_mem++;
			}
		}

	}