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


C++ StateWriter::writeFloat方法代码示例

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


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

示例1: dumpStateObjectDesc

static void
dumpBlendState(StateWriter &writer, ID3D10Device *pDevice)
{
    com_ptr<ID3D10BlendState> pBlendState;
    FLOAT BlendFactor[4];
    UINT SampleMask;

    pDevice->OMGetBlendState(&pBlendState, BlendFactor, &SampleMask);

    writer.beginMember("BlendState");
    dumpStateObjectDesc(writer, pBlendState);
    writer.endMember(); // BlendState
    
    writer.beginMember("BlendFactor");
    writer.beginArray();
    writer.writeFloat(BlendFactor[0]);
    writer.writeFloat(BlendFactor[1]);
    writer.writeFloat(BlendFactor[2]);
    writer.writeFloat(BlendFactor[3]);
    writer.endArray();
    writer.endMember(); // BlendFactor

    writer.writeIntMember("SampleMask", SampleMask);
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:24,代码来源:d3d10state.cpp

示例2: glGetProgramivARB

static inline void
dumpArbProgramUniforms(StateWriter &writer, Context &context, GLenum target, const char *prefix)
{
    if (context.ES ||
        context.core ||
        !glIsEnabled(target)) {
        return;
    }

    GLint program_parameters = 0;
    glGetProgramivARB(target, GL_PROGRAM_PARAMETERS_ARB, &program_parameters);
    if (!program_parameters) {
        return;
    }

    GLint max_program_local_parameters = 0;
    glGetProgramivARB(target, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &max_program_local_parameters);
    for (GLint index = 0; index < max_program_local_parameters; ++index) {
        GLdouble params[4] = {0, 0, 0, 0};
        glGetProgramLocalParameterdvARB(target, index, params);

        if (!params[0] && !params[1] && !params[2] && !params[3]) {
            continue;
        }

        char name[256];
        snprintf(name, sizeof name, "%sprogram.local[%i]", prefix, index);

        writer.beginMember(name);
        writer.beginArray();
        writer.writeFloat(params[0]);
        writer.writeFloat(params[1]);
        writer.writeFloat(params[2]);
        writer.writeFloat(params[3]);
        writer.endArray();
        writer.endMember();
    }

    GLint max_program_env_parameters = 0;
    glGetProgramivARB(target, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &max_program_env_parameters);
    for (GLint index = 0; index < max_program_env_parameters; ++index) {
        GLdouble params[4] = {0, 0, 0, 0};
        glGetProgramEnvParameterdvARB(target, index, params);

        if (!params[0] && !params[1] && !params[2] && !params[3]) {
            continue;
        }

        char name[256];
        snprintf(name, sizeof name, "%sprogram.env[%i]", prefix, index);

        writer.beginMember(name);
        writer.beginArray();
        writer.writeFloat(params[0]);
        writer.writeFloat(params[1]);
        writer.writeFloat(params[2]);
        writer.writeFloat(params[3]);
        writer.endArray();
        writer.endMember();
    }
}
开发者ID:Innovative-Ideas,项目名称:apitrace,代码行数:61,代码来源:glstate_shaders.cpp

示例3: assert

static void
dumpAttrib(StateWriter &writer,
           const AttribDesc &desc,
           const GLbyte *data)
{
    assert(desc);

    if (desc.numRows > 1) {
        writer.beginArray();
    }

    for (GLint row = 0; row < desc.numRows; ++row) {
        if (desc.numCols > 1) {
            writer.beginArray();
        }

        for (GLint col = 0; col < desc.numCols; ++col) {
            union {
                const GLbyte *rawvalue;
                const GLfloat *fvalue;
                const GLdouble *dvalue;
                const GLint *ivalue;
                const GLuint *uivalue;
                const GLint64 *i64value;
                const GLuint64 *ui64value;
            } u;

            u.rawvalue = data + row*desc.rowStride + col*desc.colStride;

            switch (desc.elemType) {
            case GL_FLOAT:
                writer.writeFloat(*u.fvalue);
                break;
            case GL_DOUBLE:
                writer.writeFloat(*u.dvalue);
                break;
            case GL_INT:
                writer.writeInt(*u.ivalue);
                break;
            case GL_UNSIGNED_INT:
                writer.writeInt(*u.uivalue);
                break;
            case GL_INT64_ARB:
                writer.writeInt(*u.i64value);
                break;
            case GL_UNSIGNED_INT64_ARB:
                writer.writeInt(*u.ui64value);
                break;
            case GL_BOOL:
                writer.writeBool(*u.uivalue);
                break;
            default:
                assert(0);
                writer.writeNull();
                break;
            }
        }

        if (desc.numCols > 1) {
            writer.endArray();
        }
    }

    if (desc.numRows > 1) {
        writer.endArray();
    }
}
开发者ID:Innovative-Ideas,项目名称:apitrace,代码行数:67,代码来源:glstate_shaders.cpp


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