예제 #1
0
Z3DCameraParameter::Z3DCameraParameter(const QString &name, const Z3DCamera &value, QObject *parent)
  : ZSingleValueParameter<Z3DCamera>(name, value, parent)
  , m_projectionType("Projection Type")
  , m_eye("Eye Position", value.getEye(), glm::vec3(-std::numeric_limits<float>::max()),
          glm::vec3(std::numeric_limits<float>::max()))
  , m_center("Center Position", value.getCenter(), glm::vec3(-std::numeric_limits<float>::max()),
             glm::vec3(std::numeric_limits<float>::max()))
  , m_upVector("Up Vector", value.getUpVector(), glm::vec3(-1.f), glm::vec3(1.f))
  , m_eyeSeparationAngle("Eye Separation Angle", value.getEyeSeparationAngle(), 1.f, 80.f)
  , m_fieldOfView("Field of View", value.getFieldOfView(), 10.f, 170.f)
  , m_nearDist("Near Distance", value.getNearDist(), 1e-10, std::numeric_limits<float>::max())
  , m_farDist("Far Distance", value.getFarDist(), 1e-10, std::numeric_limits<float>::max())
  , m_receiveWidgetSignal(true)
{
  m_projectionType.addOptions("Perspective", "Orthographic");
  if (value.isPerspectiveProjection())
    m_projectionType.select("Perspective");
  else
    m_projectionType.select("Orthographic");
  connect(&m_projectionType, SIGNAL(valueChanged()), this, SLOT(updateProjectionType()));

  m_eye.setSingleStep(1e-10);
  m_eye.setDecimal(10);
  //m_eye.setWidgetOrientation(Qt::Horizontal);
  m_eye.setStyle("SPINBOX");
  connect(&m_eye, SIGNAL(valueChanged()), this, SLOT(updateEye()));

  m_center.setSingleStep(1e-10);
  m_center.setDecimal(10);
  //m_center.setWidgetOrientation(Qt::Horizontal);
  m_center.setStyle("SPINBOX");
  connect(&m_center, SIGNAL(valueChanged()), this, SLOT(updateCenter()));

  m_upVector.setSingleStep(1e-10);
  m_upVector.setDecimal(10);
  m_upVector.setStyle("SPINBOX");
  connect(&m_upVector, SIGNAL(valueChanged()), this, SLOT(updateUpVector()));

  m_eyeSeparationAngle.setSingleStep(.1);
  m_eyeSeparationAngle.setDecimal(1);
  connect(&m_eyeSeparationAngle, SIGNAL(valueChanged()), this, SLOT(updateEyeSeparationAngle()));

  m_fieldOfView.setSingleStep(.1);
  m_fieldOfView.setDecimal(1);
  connect(&m_fieldOfView, SIGNAL(valueChanged()), this, SLOT(updateFieldOfView()));

  m_nearDist.setSingleStep(1e-10);
  m_nearDist.setDecimal(10);
  m_nearDist.setStyle("SPINBOX");
  m_nearDist.setRange(1e-10, value.getFarDist());
  connect(&m_nearDist, SIGNAL(valueChanged()), this, SLOT(updateNearDist()));

  m_farDist.setSingleStep(1e-10);
  m_farDist.setDecimal(10);
  m_farDist.setStyle("SPINBOX");
  m_farDist.setRange(value.getNearDist(), std::numeric_limits<float>::max());
  connect(&m_farDist, SIGNAL(valueChanged()), this, SLOT(updateFarDist()));
}
예제 #2
0
void mainLoop(const char* entryFuncName, RefalFunc entryFuncPointer)
{
    _memMngr.fieldOfView = constructStartFieldOfView(entryFuncName, entryFuncPointer);

	struct func_result_t funcRes;    
    struct lterm_t* parentCall = 0;
    int entryStatus = 0;    

    _currCallTerm = _memMngr.fieldOfView->next;

    while (_currCallTerm)
    {
        // Указатель на функцию проставлен --> функция вызывается повторно.
        if (_currCallTerm->funcCall->funcPtr)
        {            
            // Предыдущий результат успешен --> все скобки активации обработаны, можно передавать функции-потребителю.
            if (funcRes.status != FAIL_RESULT)
            {                                
                _currCallTerm->funcCall->env->workFieldOfView = _currCallTerm->funcCall->subCall;
                _currCallTerm->funcCall->subCall = 0;
                entryStatus = NEXT_ENTRYPOINT;
            }
            else // Обработка скобок активаций завершилась неудачно --> откат.
            {
                entryStatus = ROLL_BACK;
            }
        }
        else // Указатель на функцию не проставлен --> первый вызов.
        {
            entryStatus = FIRST_CALL;
            _currCallTerm->funcCall->funcPtr = getFuncPointer(_currCallTerm);

            // Первый терм в скобках аткивации не является функциональным --> откат.
            if (_currCallTerm->funcCall->funcPtr == 0)
            {
                _currCallTerm = onFuncFail(_currCallTerm, 0);
                entryStatus = ROLL_BACK;
            }
        }

        funcRes = CURR_FUNC_CALL->funcPtr(entryStatus);

        switch (funcRes.status)
        {
            case OK_RESULT:                
                _currCallTerm = updateFieldOfView(_currCallTerm, &funcRes);
                break;

            case CALL_RESULT:
                parentCall = _currCallTerm;
                _currCallTerm = addFuncCallFiledOfView(_currCallTerm, &funcRes);
                _currCallTerm->funcCall->parentCall = parentCall;
                break;
            case FAIL_RESULT:
                _currCallTerm = onFuncFail(_currCallTerm, 1);
                break;
        }

        // Обновляем счетчик вызовов функций, который используется встр.ф. Step.
        mpz_add_ui(_step, _step, 1);
	}
}