예제 #1
0
vogleditor_stateTreeStateVecMatrixRowItem::vogleditor_stateTreeStateVecMatrixRowItem(QString glenumName, GLenum name, unsigned int index, const vogl_state_vector& stateVec, float* values, unsigned int numComponents, unsigned int rowIndex, bool isIndexed, vogleditor_stateTreeItem* parent)
    : vogleditor_stateTreeStateVecDiffableItem(glenumName, "", parent),
      m_name(name),
      m_index(index),
      m_numComponents(numComponents),
      m_isIndexed(isIndexed),
      m_pState(&stateVec),
      m_rowIndex(rowIndex)
{
    setValue(getValueFromFloats(values, 4));
}
예제 #2
0
QString vogleditor_stateTreeStateVecMatrixRowItem::getDiffedValue() const
{
    static float baseValues[16];
    VOGL_ASSERT(m_numComponents <= 16);

    QString result = "";
    if (m_pDiffBaseState->get<float>(m_name, m_index, baseValues, m_numComponents, m_isIndexed))
    {
        result = getValueFromFloats(&(baseValues[m_rowIndex*4]), 4);
    }

    return result;
}
QString vogleditor_stateTreeArbProgramParamItem::getDiffedValue() const
{
    if (m_pDiffBaseState == NULL)
        return "";

    const vec4F_vec& baseParams = m_pDiffBaseState->get_program_local_params();
    if (m_paramIndex >= baseParams.size())
    {
        // this could be possible
        return "non-existent";
    }

    const vec4F& baseParam = baseParams[m_paramIndex];
    return getValueFromFloats(baseParam.get_ptr(), 1);
}
예제 #4
0
QString vogleditor_stateTreeItem::getValueFromFloats(const float* values, uint count) const
{
    QString tmp;
    if (count == 0 || values == NULL)
    {
        return "";
    }
    else if (count == 1)
    {
        tmp = tmp.sprintf("%f", *values);
    }
    else
    {
        tmp = tmp.sprintf("%s, %s", getValueFromFloats(values, 1).toStdString().c_str(), getValueFromFloats(&(values[1]), count-1).toStdString().c_str());
    }

    return tmp;
}
QString vogleditor_stateTreeTexEnvStateVecFloatItem::getDiffedValue() const
{
    if (m_pDiffBaseState == NULL || m_pDiffBaseInfo == NULL)
        return "";

    if (m_index >= m_pDiffBaseInfo->get_max_texture_coords())
    {
        // this index did not exist in the base state, so it must be new
        return "non-existent";
    }

    float baseVals[4] = { 0, 0, 0, 0 };
    if (m_pDiffBaseState->get_state(m_target).get<float>(m_name, m_index, baseVals, m_numComponents))
    {
        return getValueFromFloats(baseVals, m_numComponents);
    }
    else
    {
        // the values could not be obtained from both states, so something must have changed
        return "non-existent";
    }
}
vogleditor_stateTreeTexEnvStateVecFloatItem::vogleditor_stateTreeTexEnvStateVecFloatItem(GLenum target, QString glenumName, GLenum name, unsigned int index, float *values, unsigned int numComponents, vogleditor_stateTreeItem *parent, vogl_texenv_state &state)
    : vogleditor_stateTreeTexEnvStateVecDiffableItem(target, name, index, numComponents, glenumName, "", parent),
      m_pState(&state)
{
    setValue(getValueFromFloats(values, numComponents));
}
예제 #7
0
vogleditor_stateTreeStateVecFloatItem::vogleditor_stateTreeStateVecFloatItem(QString glenumName, GLenum name, unsigned int index, const vogl_state_vector& stateVec, float* values, unsigned int numComponents, bool isIndexed, vogleditor_stateTreeItem* parent)
   : vogleditor_stateTreeDatatypeItem<float>(glenumName, name, index, stateVec, numComponents, isIndexed, parent)
{
    setValue(getValueFromFloats(values, numComponents));
}