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


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

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


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

示例1: assert

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

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

    for (GLint row = 0; row < desc.numRows; ++row) {
        if (desc.numCols > 1) {
            json.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;
            } u;

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

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

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

    if (desc.numRows > 1) {
        json.endArray();
    }
}
开发者ID:zhangjitao,项目名称:apitrace,代码行数:59,代码来源:glstate_shaders.cpp

示例2: glGetProgramivARB

static inline void
dumpArbProgramUniforms(JSONWriter &json, GLenum target, const char *prefix)
{
    if (!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);

        json.beginMember(name);
        json.beginArray();
        json.writeFloat(params[0]);
        json.writeFloat(params[1]);
        json.writeFloat(params[2]);
        json.writeFloat(params[3]);
        json.endArray();
        json.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);

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

示例3: dumpStateObjectDesc

static void
dumpBlendState(JSONWriter &json, ID3D11DeviceContext *pDeviceContext)
{
    com_ptr<ID3D11BlendState> pBlendState;
    FLOAT BlendFactor[4];
    UINT SampleMask;

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

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

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


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