本文整理汇总了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);
}
示例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();
}