Пример #1
0
void
Driver::executeBuffer(const gpu::ringbuffer::Buffer &buffer)
{
   decaf_check(!mActiveSyncWaiter);

   // Begin our command group (sync waiter)
   beginCommandGroup();

   // Begin preparing our command buffer
   beginCommandBuffer();

   // Execute guest PM4 command buffer
   runCommandBuffer(buffer);

   // End preparing our command buffer
   endCommandBuffer();

   // Submit the generated command buffer to the host GPU queue
   vk::SubmitInfo submitInfo;
   submitInfo.commandBufferCount = 1;
   submitInfo.pCommandBuffers = &mActiveCommandBuffer;
   mQueue.submit({ submitInfo }, mActiveSyncWaiter->fence);

   // End our command group
   endCommandGroup();

   // Optimize the memory layout of our segments every 10 frames.
   if (mActiveBatchIndex % 10 == 0) {
      mMemTracker.optimize();
   }
}
        bool CreateEntityTool::handleDragDrop(InputState& inputState, const String& payload) {
            assert(m_entity != NULL);

            beginCommandGroup(wxT("Create Entity"));
            Controller::AddObjectsCommand* addObjectsCommand = Controller::AddObjectsCommand::addEntity(document(), *m_entity);
            submitCommand(addObjectsCommand);
            Controller::ChangeEditStateCommand* changeEditStateCommand = Controller::ChangeEditStateCommand::replace(document(), *m_entity);
            submitCommand(changeEditStateCommand);
            endCommandGroup();
            
            m_entity = NULL;
            deleteFigure(m_entityFigure);
            m_entityFigure = NULL;

            return true;
        }
Пример #3
0
        void CreateBrushTool::handleEndPlaneDrag(InputState& inputState) {
            assert(m_brush != NULL);
            assert(m_brushFigure != NULL);
            
            Controller::AddObjectsCommand* addBrushCommand = Controller::AddObjectsCommand::addBrush(document(), *m_brush);
            Controller::ChangeEditStateCommand* selectBrushCommand = Controller::ChangeEditStateCommand::replace(document(), *m_brush);
            
            beginCommandGroup(wxT("Create Brush"));
            submitCommand(addBrushCommand);
            submitCommand(selectBrushCommand);
            endCommandGroup();
            
            m_brush = NULL;

            deleteFigure(m_brushFigure);
            m_brushFigure = NULL;
        }
        bool RotateObjectsTool::handleStartDrag(InputState& inputState) {
            if (inputState.mouseButtons() != MouseButtons::MBLeft ||
                inputState.modifierKeys() != ModifierKeys::MKNone)
                return false;

            Model::EditStateManager& editStateManager = document().editStateManager();
            const Model::EntityList& entities = editStateManager.selectedEntities();
            const Model::BrushList& brushes = editStateManager.selectedBrushes();
            if (entities.empty() && brushes.empty())
                return false;

            Model::RotateHandleHit* hit = static_cast<Model::RotateHandleHit*>(inputState.pickResult().first(Model::HitType::RotateHandleHit, true, view().filter()));

            if (hit == NULL)
                return false;

            Vec3f test = hit->hitPoint() - m_rotateHandle.position();
            switch (hit->hitArea()) {
                case Model::RotateHandleHit::HAXAxis:
                    m_axis = Vec3f::PosX;
                    m_invert = ((test.dot(Vec3f::PosX) > 0.0f) == (test.dot(Vec3f::PosY) > 0.0f));
                    break;
                case Model::RotateHandleHit::HAYAxis:
                    m_axis = Vec3f::PosY;
                    m_invert = ((test.dot(Vec3f::PosX) > 0.0f) != (test.dot(Vec3f::PosY) > 0.0f));
                    break;
                case Model::RotateHandleHit::HAZAxis:
                    m_axis = Vec3f::PosZ;
                    m_invert = false;
                    break;
            }

            m_startX = inputState.x();
            m_startY = inputState.y();
            m_angle = 0.0f;
            m_center = m_rotateHandle.position();
            m_rotateHandle.lock();
            beginCommandGroup(Controller::Command::makeObjectActionName(wxT("Rotate"), entities, brushes));

            return true;
        }