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


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

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


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

示例1: 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

示例2: Read

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

	bool moreTokens;
	do 
	{
		// We need to "peek" because if the token isn't giving us one
		// of the sphere properties, then it is a shape attribute like
		// color and if we've already read it out of the file, the shape
		// class would not be able to read the attribute afterwords.
		// So we "peek" at the token which does not remove it from the 
		// file stream.  For more information, see the "PeekTokens" 
		// method defined in the Loader class
		input.PeekTokens(token, 1);
		
		moreTokens = true;
		if (strcmp(token, "center") == 0)
		{
			input.ReadToken(token);
			for (int i = 0; i < 3; i++)
				if (!input.ReadFloat(center[i]))
					input.Error("Not enough parameters for sphere's center in sphere '%s'", objectName);
		}
		else if (strcmp(token, "radius") == 0)
		{
			input.ReadToken(token);
			if (!input.ReadFloat(radius))
				input.Error("Error reading radius in sphere '%s'", objectName);
		}
		else if (strcmp(token, "resolution") == 0)
		{
			input.ReadToken(token);
			if (!input.ReadInt(resolution))
				input.Error("Error reading resolution in sphere '%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,代码行数:42,代码来源:BasicShapes.cpp


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