Example #1
0
void JsonStream::valueToInt(json::Value &value, int &integer)
{
    if(value.GetType() == json::IntVal)
    {
        integer = value;
    }
    else
    {
        mIsOk = false;
        mErrorLog += "JsonStream::valueToInt() Error: wrong type\n";
    }
}
Example #2
0
void JsonStream::valueToString(json::Value &value, std::string& str)
{
    if(value.GetType() == json::StringVal)
    {
        str = value.ToString();
    }
    else
    {
        mIsOk = false;
        mErrorLog += "JsonStream::valueToString() Error: wrong type\n";
    }
}
Example #3
0
void JsonStream::valueToBool(json::Value &value, bool &boolean)
{
    if(value.GetType() == json::BoolVal)
    {
        boolean = value;
    }
    else
    {
        mIsOk = false;
        mErrorLog += "JsonStream::valueToBool() Error: wrong type\n";
    }
}
Example #4
0
Sampler::Ptr SamplerLoader::ParseSampler(ResourceManager& resourceManager, const json::Value& root)
{
	if (root.GetType() == StringVal)
	{
		return resourceManager.LoadResource<Sampler>(root.ToString());
	}

	SamplerDescription description;

	description.samplingMode = ParseSamplingMode(root["sampling"].ToString("basic"));
	description.anisotropicEnabled = root["anisotropicEnabled"].ToBool(false);

	description.minFilter = ParseInterpolatioMode(root["minFilter"].ToString("linear"));
	description.magFilter = ParseInterpolatioMode(root["magFilter"].ToString("linear"));
	description.mipFilter = ParseInterpolatioMode(root["mipFilter"].ToString("linear"));
	
	description.uWrap = ParseEdgeSampling(root["uWrap"].ToString("clamp"));
	description.vWrap = ParseEdgeSampling(root["vWrap"].ToString("clamp"));
	description.wWrap = ParseEdgeSampling(root["wWrap"].ToString("clamp"));

	description.useMipMap = root["useMipMap"].ToBool(description.useMipMap);

	description.mipBias = root["mipBias"].ToFloat(description.mipBias);
	description.minLOD = root["minLOD"].ToFloat(description.minLOD);
	description.maxLOD = root["maxLOD"].ToFloat(description.maxLOD);

	description.compareFunction = JsonTypeHelper::ParseCompareFunction(root["compareFunction"].ToString("never"));

	description.maxAnisotropy = root["maxAnisotropy"].ToInt(description.maxAnisotropy);

	if (root.HasKey("borderColor"))
	{
		description.borderColor = JsonTypeHelper::ParseColor(root["borderColor"]);
	}

	return resourceManager.GetGraphics()->CreateSampler(description);
}