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


C++ TIntermConstantUnion::getLine方法代码示例

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


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

示例1: parseValue

ParsedValue Parser::parseValue(TIntermTyped* e) {
    auto binary = e->getAsBinaryNode();
    auto symbol = e->getAsSymbolNode();
    auto aggregate = e->getAsAggregate();
    TIntermConstantUnion* constunion = e->getAsConstantUnion();
    if (binary != nullptr) {
        CodeOp op;
        switch (binary->getOp()) {
        case EOpAdd:
            op = CAdd;
            break;
        case EOpSub:
            op = CSub;
            break;
        case EOpMul:
            op = CMul;
            break;
        case EOpDiv:
            op = CDiv;
            break;
        case EOpLessThan:
            op = CLt;
            break;
        case EOpGreaterThan:
            op = CGt;
            break;
        case EOpLessThanEqual:
            op = CLte;
            break;
        case EOpGreaterThanEqual:
            op = CGte;
            break;
        case EOpEqual:
            op = CEq;
            break;
        case EOpNotEqual:
            op = CNeq;
            break;
        case EOpLogicalOr:
            op = COr;
            break;
        case EOpLogicalAnd:
            op = COr;
            break;
        case EOpMatrixTimesVector:
            op = CMul;
            break;
        case EOpVectorSwizzle: {
            auto field = new PField;
            field->e = parseValue(binary->getLeft());
            for (unsigned i = 0; i < binary->getRight()->getAsAggregate()->getSequence().size(); ++i) {
                int num = binary->getRight()->getAsAggregate()->getSequence()[i]->getAsConstantUnion()->getUnionArrayPointer()->getIConst();
                switch (num) {
                case 0:
                    field->field += "x";
                    break;
                case 1:
                    field->field += "y";
                    break;
                case 2:
                    field->field += "z";
                    break;
                case 3:
                    field->field += "w";
                    break;
                }
            }
            ParsedValue value;
            value.v = field;
            value.p = binary->getLine().first_line;
            return value;
        }
        //case OpMod: CMod;
        //case OpInterval: CInterval;
        default:
            error("Unsupported operation", e->getLine().first_line);
        }
        ParsedValue value;
        value.v = new POp(op, parseValue(binary->getLeft()), parseValue(binary->getRight()));
        value.p = e->getLine().first_line;
        return value;
    }
    else if (symbol != nullptr) {
        ParsedValue value;
        auto var = new PVar;
        var->v = symbol->getSymbol().c_str();
        value.v = var;
        value.p = e->getLine().first_line;
        return value;
    }
    else if (constunion != nullptr) {
        ParsedValue value;
        value.p = constunion->getLine().first_line;
        auto constVar = new PConst;
        switch (constunion->getType().getBasicType()) {
        case EbtFloat:
            constVar->c = new ConstFloat(constunion->getUnionArrayPointer()->getFConst());
            break;
        default:
            error("Unknown type", constunion->getLine().first_line);
//.........这里部分代码省略.........
开发者ID:theomission,项目名称:kfx,代码行数:101,代码来源:Parser.cpp


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