diff --git a/Projects/Editor/Source/Editor/CEditor.cpp b/Projects/Editor/Source/Editor/CEditor.cpp index 091ab2706..d6d0cca21 100644 --- a/Projects/Editor/Source/Editor/CEditor.cpp +++ b/Projects/Editor/Source/Editor/CEditor.cpp @@ -39,7 +39,6 @@ This file is part of the "Skylicht Engine". #include "SpaceController/CSceneController.h" #include "SpaceController/CPropertyController.h" -#include "SpaceController/CCollisionController.h" #include "AssetManager/CAssetManager.h" #include "Selection/CSelection.h" @@ -74,7 +73,6 @@ namespace Skylicht m_spriteIcon->updateTexture(); // init controller - CCollisionController::createGetInstance(); CSceneController::createGetInstance()->initContextMenu(m_canvas); CPropertyController::createGetInstance(); CSelection::createGetInstance(); @@ -87,7 +85,6 @@ namespace Skylicht CEditorActivator::releaseInstance(); CPropertyController::releaseInstance(); CSceneController::releaseInstance(); - CCollisionController::releaseInstance(); CSelection::releaseInstance(); CProjectSettings::releaseInstance(); diff --git a/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.cpp b/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.cpp index 5c467a0ad..a5901b26e 100644 --- a/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.cpp +++ b/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.cpp @@ -34,7 +34,6 @@ This file is part of the "Skylicht Engine". #include "Projective/CProjective.h" #include "Editor/SpaceController/CSceneController.h" -#include "Editor/SpaceController/CCollisionController.h" #include "Editor/Gizmos/Transform/CTransformGizmos.h" @@ -63,7 +62,7 @@ namespace Skylicht m_view(NULL), m_handlesRenderer(NULL), m_gizmosRenderer(NULL), - m_pickSystem(NULL), + m_selectObjectSystem(NULL), m_enableRender(true) { initDefaultScene(); @@ -238,8 +237,8 @@ namespace Skylicht // add handle renderer CEntityManager* entityMgr = m_scene->getEntityManager(); - m_pickSystem = entityMgr->addSystem(); - m_pickSystem->setCullingCamera(m_editorCamera); + m_selectObjectSystem = entityMgr->addSystem(); + m_selectObjectSystem->setCullingCamera(m_editorCamera); m_handlesRenderer = entityMgr->addRenderSystem(); m_gizmosRenderer = entityMgr->addRenderSystem(); diff --git a/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.h b/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.h index 6b26ec786..0ef159ffe 100644 --- a/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.h +++ b/Projects/Editor/Source/Editor/Space/Scene/CSpaceScene.h @@ -29,7 +29,7 @@ This file is part of the "Skylicht Engine". #include "Editor/History/CSceneHistory.h" #include "EditorComponents/Handles/CHandlesRenderer.h" #include "EditorComponents/Gizmos/CGizmosRenderer.h" -#include "EditorComponents/PickCollision/CPickCollisionSystem.h" +#include "EditorComponents/SelectObject/CSelectObjectSystem.h" #include "CViewpointController.h" @@ -85,7 +85,7 @@ namespace Skylicht CHandlesRenderer* m_handlesRenderer; CGizmosRenderer* m_gizmosRenderer; - CPickCollisionSystem* m_pickSystem; + CSelectObjectSystem* m_selectObjectSystem; GUI::CButton* m_toolbarButton[ToolbarCount]; diff --git a/Projects/Editor/Source/Editor/SpaceController/CCollisionController.cpp b/Projects/Editor/Source/Editor/SpaceController/CCollisionController.cpp deleted file mode 100644 index e34134981..000000000 --- a/Projects/Editor/Source/Editor/SpaceController/CCollisionController.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* -!@ -MIT License - -Copyright (c) 2021 Skylicht Technology CO., LTD - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files -(the "Software"), to deal in the Software without restriction, including without limitation the Rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -This file is part of the "Skylicht Engine". -https://github.com/skylicht-lab/skylicht-engine -!# -*/ - -#include "pch.h" -#include "CCollisionController.h" - -namespace Skylicht -{ - namespace Editor - { - CCollisionController::CCollisionController() - { - } - - CCollisionController::~CCollisionController() - { - } - - void CCollisionController::clear() - { - } - } -} \ No newline at end of file diff --git a/Projects/Editor/Source/Editor/SpaceController/CCollisionController.h b/Projects/Editor/Source/Editor/SpaceController/CCollisionController.h deleted file mode 100644 index 3d932f4a7..000000000 --- a/Projects/Editor/Source/Editor/SpaceController/CCollisionController.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -!@ -MIT License - -Copyright (c) 2021 Skylicht Technology CO., LTD - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files -(the "Software"), to deal in the Software without restriction, including without limitation the Rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -This file is part of the "Skylicht Engine". -https://github.com/skylicht-lab/skylicht-engine -!# -*/ - -#pragma once - -#include "Utils/CGameSingleton.h" -#include "EditorComponents/PickCollision/CPickCollisionData.h" - -namespace Skylicht -{ - namespace Editor - { - class CCollisionController :public CGameSingleton - { - protected: - - public: - CCollisionController(); - - virtual ~CCollisionController(); - - void clear(); - }; - } -} \ No newline at end of file diff --git a/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp b/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp index 6682f6720..f74d19bfa 100644 --- a/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp +++ b/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp @@ -26,7 +26,6 @@ This file is part of the "Skylicht Engine". #include "CSceneController.h" #include "CPropertyController.h" -#include "CCollisionController.h" #include "Selection/CSelection.h" @@ -140,7 +139,6 @@ namespace Skylicht // clear current scene gui CSelection::getInstance()->clear(); CPropertyController::getInstance()->setProperty(NULL); - CCollisionController::getInstance()->clear(); CHandles::getInstance()->end(); CHandles::getInstance()->setNullRenderer(); diff --git a/Projects/Editor/Source/EditorComponents/DirectionLight/CGDirectionLight.cpp b/Projects/Editor/Source/EditorComponents/DirectionLight/CGDirectionLight.cpp index 318ca87aa..904f58ee3 100644 --- a/Projects/Editor/Source/EditorComponents/DirectionLight/CGDirectionLight.cpp +++ b/Projects/Editor/Source/EditorComponents/DirectionLight/CGDirectionLight.cpp @@ -34,7 +34,7 @@ This file is part of the "Skylicht Engine". #include "Editor/CEditor.h" #include "Handles/CHandles.h" -#include "Editor/SpaceController/CCollisionController.h" +#include "EditorComponents/SelectObject/CSelectObjectData.h" namespace Skylicht { @@ -73,9 +73,10 @@ namespace Skylicht // pick collision CEntity* entity = m_gameObject->getEntity(); entity->addData(); - CPickCollisionData* pickData = entity->addData(); - pickData->GameObject = m_gameObject; - pickData->BBox = m_defaultBBox; + + CSelectObjectData* selectObject = entity->addData(); + selectObject->GameObject = m_gameObject; + selectObject->BBox = m_defaultBBox; } void CGDirectionLight::updateComponent() @@ -89,10 +90,9 @@ namespace Skylicht // update collision bbox float boxScale = m_sprite->getViewScale() * 10.0f; - CPickCollisionData* pickData = m_gameObject->getEntity()->getData(); - pickData->GameObject = m_gameObject; - pickData->BBox.MinEdge = m_defaultBBox.MinEdge * boxScale; - pickData->BBox.MaxEdge = m_defaultBBox.MaxEdge * boxScale; + CSelectObjectData* selectObject = m_gameObject->getEntity()->getData(); + selectObject->BBox.MinEdge = m_defaultBBox.MinEdge * boxScale; + selectObject->BBox.MaxEdge = m_defaultBBox.MaxEdge * boxScale; } } } \ No newline at end of file diff --git a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionData.cpp b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectData.cpp similarity index 91% rename from Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionData.cpp rename to Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectData.cpp index adc5a695b..d60f66e53 100644 --- a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionData.cpp +++ b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectData.cpp @@ -23,18 +23,18 @@ This file is part of the "Skylicht Engine". */ #include "pch.h" -#include "CPickCollisionData.h" +#include "CSelectObjectData.h" namespace Skylicht { namespace Editor { - CPickCollisionData::CPickCollisionData() + CSelectObjectData::CSelectObjectData() { } - CPickCollisionData::~CPickCollisionData() + CSelectObjectData::~CSelectObjectData() { } } diff --git a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionData.h b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectData.h similarity index 92% rename from Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionData.h rename to Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectData.h index 0d41bf7c5..4a4f49a64 100644 --- a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionData.h +++ b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectData.h @@ -31,7 +31,7 @@ namespace Skylicht { namespace Editor { - class CPickCollisionData : public IEntityData + class CSelectObjectData : public IEntityData { public: CGameObject* GameObject; @@ -39,9 +39,9 @@ namespace Skylicht core::aabbox3df BBox; public: - CPickCollisionData(); + CSelectObjectData(); - virtual ~CPickCollisionData(); + virtual ~CSelectObjectData(); }; } } \ No newline at end of file diff --git a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionSystem.cpp b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectSystem.cpp similarity index 85% rename from Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionSystem.cpp rename to Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectSystem.cpp index 18abea43f..a57f32c34 100644 --- a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionSystem.cpp +++ b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectSystem.cpp @@ -23,8 +23,7 @@ This file is part of the "Skylicht Engine". */ #include "pch.h" -#include "CPickCollisionSystem.h" -#include "Editor/SpaceController/CCollisionController.h" +#include "CSelectObjectSystem.h" #include "Culling/CCullingData.h" #include "Culling/CVisibleData.h" @@ -35,18 +34,18 @@ namespace Skylicht { namespace Editor { - CPickCollisionSystem::CPickCollisionSystem() : + CSelectObjectSystem::CSelectObjectSystem() : m_cullingCamera(NULL) { } - CPickCollisionSystem::~CPickCollisionSystem() + CSelectObjectSystem::~CSelectObjectSystem() { } - void CPickCollisionSystem::beginQuery(CEntityManager* entityManager) + void CSelectObjectSystem::beginQuery(CEntityManager* entityManager) { if (entityManager->getCamera() != m_cullingCamera) { @@ -62,7 +61,7 @@ namespace Skylicht m_skipUpdate = false; } - void CPickCollisionSystem::onQuery(CEntityManager* entityManager, CEntity* entity) + void CSelectObjectSystem::onQuery(CEntityManager* entityManager, CEntity* entity) { if (m_skipUpdate) return; @@ -77,7 +76,7 @@ namespace Skylicht if (visibleData != NULL && !visibleData->Visible) return; - CPickCollisionData* collisionData = entity->getData(); + CSelectObjectData* collisionData = entity->getData(); if (collisionData != NULL) { CWorldTransformData* transform = entity->getData(); @@ -89,17 +88,17 @@ namespace Skylicht } } - void CPickCollisionSystem::init(CEntityManager* entityManager) + void CSelectObjectSystem::init(CEntityManager* entityManager) { } - void CPickCollisionSystem::update(CEntityManager* entityManager) + void CSelectObjectSystem::update(CEntityManager* entityManager) { if (m_skipUpdate) return; - CPickCollisionData** collisions = m_collision.pointer(); + CSelectObjectData** collisions = m_collision.pointer(); CWorldTransformData** transforms = m_transform.pointer(); CWorldInverseTransformData** invTransforms = m_invTransform.pointer(); @@ -112,7 +111,7 @@ namespace Skylicht { CWorldTransformData* transform = transforms[i]; CWorldInverseTransformData* invTransform = invTransforms[i]; - CPickCollisionData* collision = collisions[i]; + CSelectObjectData* collision = collisions[i]; core::aabbox3df transformBBox = collision->BBox; transform->World.transformBoxEx(transformBBox); diff --git a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionSystem.h b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectSystem.h similarity index 86% rename from Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionSystem.h rename to Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectSystem.h index 4fa9ae1e3..8c942d969 100644 --- a/Projects/Editor/Source/EditorComponents/PickCollision/CPickCollisionSystem.h +++ b/Projects/Editor/Source/EditorComponents/SelectObject/CSelectObjectSystem.h @@ -27,7 +27,7 @@ This file is part of the "Skylicht Engine". #include "Entity/IEntityData.h" #include "Entity/IEntitySystem.h" -#include "CPickCollisionData.h" +#include "CSelectObjectData.h" #include "Transform/CWorldTransformData.h" #include "Transform/CWorldInverseTransformData.h" @@ -37,12 +37,12 @@ namespace Skylicht { namespace Editor { - class CPickCollisionSystem : public IEntitySystem + class CSelectObjectSystem : public IEntitySystem { protected: - core::array m_results; + core::array m_results; - core::array m_collision; + core::array m_collision; core::array m_transform; core::array m_invTransform; @@ -51,9 +51,9 @@ namespace Skylicht bool m_skipUpdate; public: - CPickCollisionSystem(); + CSelectObjectSystem(); - virtual ~CPickCollisionSystem(); + virtual ~CSelectObjectSystem(); virtual void beginQuery(CEntityManager* entityManager); @@ -68,7 +68,7 @@ namespace Skylicht m_cullingCamera = camera; } - inline core::array& getCulledCollision() + inline core::array& getCulledCollision() { return m_results; }