本文整理汇总了C++中TextInput::readNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ TextInput::readNumber方法的具体用法?C++ TextInput::readNumber怎么用?C++ TextInput::readNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextInput
的用法示例。
在下文中一共展示了TextInput::readNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Vector2::deserialize(TextInput& t) {
t.readSymbol("(");
x = (float)t.readNumber();
t.readSymbol(",");
y = (float)t.readNumber();
t.readSymbol(")");
}
示例2: readNormal
static Vector3 readNormal(TextInput& ti, const Matrix3& normalXform) {
Vector3 n;
n.x = ti.readNumber();
n.y = ti.readNumber();
n.z = ti.readNumber();
return (normalXform * n).direction();
}
示例3: readVertex
static Vector3 readVertex(TextInput& ti, const Matrix4& xform) {
// Vertex
Vector4 v;
v.x = ti.readNumber();
v.y = ti.readNumber();
v.z = ti.readNumber();
v.w = 1.0f;
return (xform * v).xyz();
}
示例4: iRound
void GPUProgram::BindingTable::parseConstant(TextInput& ti) {
if (consumeSymbol(ti, "c") && consumeSymbol(ti, "[")) {
// constant
Token t = ti.peek();
if (t.type() == Token::NUMBER) {
Binding binding;
binding.source = CONSTANT;
binding.type = FLOAT4;
binding.slot = iRound(ti.readNumber());
if (consumeSymbol(ti, "]") && consumeSymbol(ti, "=")) {
for (int i = 0; i < 4; ++i) {
t = ti.peek();
if (t.type() == Token::NUMBER) {
binding.vector[i] = ti.readNumber();
}
}
bindingArray.append(binding);
}
}
}
}
示例5: alwaysAssertM
void GPUProgram::BindingTable::parseVariable(TextInput& ti) {
std::string name;
// #var float4 osLight : : c[4] : 1 : 1
// #var float3 vin.v0 : $vin.POSITION : ATTR0 : 2 : 1
Token t = ti.peek();
if (t.type() != Token::SYMBOL) {
goto abort;
}
// get the binding's type
ti.readSymbol();
Type type;
if (! CgType(t.string(), type)) {
alwaysAssertM(false, std::string("Unsupported type: \"") + t.string() + "\"");
}
t = ti.peek();
if (t.type() != Token::SYMBOL) {
goto abort;
}
// read the binding name
name = ti.readSymbol();
if (! consumeSymbol(ti, ":")) {
goto abort;
}
// see if it is the vertex or a constant register
t = ti.peek();
if (t.type() != Token::SYMBOL) {
goto abort;
}
// Sometimes there is an extra token between the colons
if (t.string() != ":") {
ti.readSymbol();
t = ti.peek();
}
if (! consumeSymbol(ti, ":")) {
goto abort;
}
// read the register number
t = ti.peek();
if (t.type() != Token::SYMBOL) {
goto abort;
}
// Consume the symbol we just peeked
ti.readSymbol();
if (t.string() == "texunit") {
// We're reading a texture unit
} else if (t.string() == "c") {
// We're reading a regular variable; parse the open bracket
if (! consumeSymbol(ti, "[")) {
goto abort;
}
} else if ((t.type() == Token::SYMBOL) && (t.string() == ":")) {
// Unused variable; must be present but is not bound
Binding binding;
binding.source = VARIABLE;
binding.type = type;
binding.name = name;
binding.slot = Binding::UNASSIGNED;
bindingArray.append(binding);
return;
} else {
// Something unexpected happened.
goto abort;
}
t = ti.peek();
if (t.type() == Token::NUMBER) {
int slot = iRound(ti.readNumber());
Binding binding;
binding.source = VARIABLE;
binding.type = type;
binding.name = name;
binding.slot = slot;
bindingArray.append(binding);
}
abort:
;// Jump here if anything unexpected is encountered during parsing
//.........这里部分代码省略.........