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


C++ TextInput::readNumber方法代码示例

本文整理汇总了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(")");
}
开发者ID:Akenyshka,项目名称:MythCore,代码行数:7,代码来源:Vector2.cpp

示例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();
}
开发者ID:luaman,项目名称:g3d-cvs,代码行数:8,代码来源:ArticulatedModel_OBJ.cpp

示例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();
}
开发者ID:luaman,项目名称:g3d-cvs,代码行数:9,代码来源:ArticulatedModel_OBJ.cpp

示例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);
            }
        }
    }
}
开发者ID:luaman,项目名称:g3d-cpp,代码行数:23,代码来源:GPUProgram.cpp

示例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
//.........这里部分代码省略.........
开发者ID:luaman,项目名称:g3d-cpp,代码行数:101,代码来源:GPUProgram.cpp


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