当前位置: 首页>>代码示例>>C++>>正文


C++ Loader::ReadFloat方法代码示例

本文整理汇总了C++中Loader::ReadFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ Loader::ReadFloat方法的具体用法?C++ Loader::ReadFloat怎么用?C++ Loader::ReadFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Loader的用法示例。


在下文中一共展示了Loader::ReadFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Read

void cone::Read(Loader &input)
{
	char token[MAX_INPUT_LENGTH];

	bool moreTokens;
	do 
	{
		input.PeekTokens(token, 1);
		
		moreTokens = true;
		if (strcmp(token, "base") == 0)
		{
			input.ReadToken(token);
			for (int i = 0; i < 3; i++)
				if (!input.ReadFloat(base[i]))
					input.Error("Not enough parameters for cone's base in cone '%s'", objectName);
		}
		else if (strcmp(token, "radius") == 0)
		{
			input.ReadToken(token);
			if (!input.ReadFloat(radius))
				input.Error("Error reading radius in cone '%s'", objectName);
		}
		else if (strcmp(token, "height") == 0)
		{
			input.ReadToken(token);
			if (!input.ReadFloat(height))
				input.Error("Error reading height in cone '%s'", objectName);
		}
		else if (strcmp(token, "axis") == 0)
		{
			input.ReadToken(token);
			if (!input.ReadInt(axis))
				input.Error("Error reading axis number in cone '%s'", objectName);
		}
		else if (strcmp(token, "capped") == 0)
		{
			input.ReadToken(token);
			if (!input.ReadBool(capped))
				input.Error("Error reading height in cone '%s'", objectName);
		}
		else if (strcmp(token, "resolution") == 0)
		{
			input.ReadToken(token);
			if (!input.ReadInt(resolution))
				input.Error("Error reading resolution in cone '%s'", objectName);
		}
		else 
			moreTokens = false; // If we don't recognize it jump out ... it is an attribute
	} while (moreTokens);

	SetupShape();
}
开发者ID:HHMedina,项目名称:DePaul-UNI-Projects,代码行数:53,代码来源:BasicShapes.cpp

示例2: Load

void glslShader::Load(Loader &input)
{
	char token[MAX_INPUT_LENGTH];

	do
	{
		input.ReadToken(token);

		if (strcmp(token, "vertexshader") == 0)
		{
			char tmp[256];
			if (!input.ReadToken(tmp))
				input.Error("Couldn't find vertex shader name after vertexShader token in glslShader");
			else
				sprintf(vertexShaderName, "%s", tmp);
		}
		else if (strcmp(token, "fragmentshader") == 0)
		{
			char tmp[256];
			if (!input.ReadToken(tmp))
				input.Error("Couldn't find fragment shader name after vertexShader token in glslShader");
			else
				sprintf(fragmentShaderName, "%s", tmp);
		}
		else if (strcmp(token, "uniform") == 0)
		{
			input.ReadToken(uniformParamNames[nUniforms], true, false);  // This token should be upper & lower case
			nUniformComponents[nUniforms] = 0;
			for (int i = 0; i < 4; i++)
			{
				if (!input.ReadFloat(uniformParamValues[nUniforms][i]))
				{
					if (i == 0)	
						input.Error("Incomplete uniform parameter %s\n", uniformParamNames[nUniforms]);
					break;
				}
				else
					nUniformComponents[nUniforms]++;
			}
			nUniforms++;
		}
		else if (strncmp(token, "end", 3) != 0)
			input.Error(token, "Unrecognized glslShader shader command: %s", token);
	} while (strncmp(token, "end", 3) != 0);
}
开发者ID:HHMedina,项目名称:DePaul-UNI-Projects,代码行数:45,代码来源:ShaderLoad.cpp


注:本文中的Loader::ReadFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。