void CModel::Update(CCommandObservable *observable, CommandType command) { if (command == ExitProgram) { m_isNotExit = false; } else if (command == CreateShape) { m_domainModel->CreateNewFigure(); } else if (command = DeleteShape) { m_domainModel->DeleteFigure(); } UpdateShapes(); }
void Patch::Update(float dt) { UpdateShapes(); _transform.position += _transform.linearVelocity * dt; _transform.rotation = glm::slerp(_transform.rotation, _transform.rotation * _transform.angularVelocity, dt); glm::mat4 translateMat = glm::translate(glm::mat4(), _transform.position); glm::mat4 rotateOriginMat = glm::translate(glm::mat4(), _transform.rotationOrigin); glm::mat4 rotateMat = rotateOriginMat * glm::mat4_cast(_transform.rotation) * glm::inverse(rotateOriginMat); glm::mat4 scaleOriginMat = glm::translate(glm::mat4(), _transform.scaleOrigin); glm::mat4 scaleMat = scaleOriginMat * glm::scale(glm::mat4(), _transform.scale) * glm::inverse(scaleOriginMat); glm::mat4 *parentModelMat = _transform.parent ? &_transform.parent->modelMat : &glm::mat4(); _transform.modelMat = (*parentModelMat) * (translateMat * scaleMat* rotateMat); }