-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#80 Add interface of Decals (not yet)
- Loading branch information
1 parent
8cb3eec
commit 412db87
Showing
15 changed files
with
397 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
!@ | ||
MIT License | ||
Copyright (c) 2022 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 "CDecalData.h" | ||
|
||
namespace Skylicht | ||
{ | ||
IMPLEMENT_DATA_TYPE_INDEX(CDecalData); | ||
|
||
CDecalData::CDecalData() | ||
{ | ||
|
||
} | ||
|
||
CDecalData::~CDecalData() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
!@ | ||
MIT License | ||
Copyright (c) 2022 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 "Entity/IEntityData.h" | ||
|
||
namespace Skylicht | ||
{ | ||
class CDecalData : public IEntityData | ||
{ | ||
public: | ||
core::vector3df Dimension; | ||
core::vector3df Normal; | ||
float TextureRotation; | ||
float LifeTime; | ||
float Distance; | ||
|
||
DECLARE_DATA_TYPE_INDEX; | ||
|
||
public: | ||
CDecalData(); | ||
|
||
virtual ~CDecalData(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
!@ | ||
MIT License | ||
Copyright (c) 2022 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 "CDecals.h" | ||
#include "CDecalsRenderer.h" | ||
#include "CDecalData.h" | ||
#include "GameObject/CGameObject.h" | ||
#include "Entity/CEntityManager.h" | ||
#include "Transform/CWorldTransformData.h" | ||
|
||
namespace Skylicht | ||
{ | ||
ACTIVATOR_REGISTER(CDecals); | ||
|
||
CATEGORY_COMPONENT(CDecals, "Renderer", "Decals"); | ||
|
||
CDecals::CDecals() | ||
{ | ||
|
||
} | ||
|
||
CDecals::~CDecals() | ||
{ | ||
|
||
} | ||
|
||
void CDecals::initComponent() | ||
{ | ||
m_gameObject->getEntityManager()->addRenderSystem<CDecalsRenderer>(); | ||
} | ||
|
||
void CDecals::updateComponent() | ||
{ | ||
|
||
} | ||
|
||
CObjectSerializable* CDecals::createSerializable() | ||
{ | ||
return CComponentSystem::createSerializable(); | ||
} | ||
|
||
void CDecals::loadSerializable(CObjectSerializable* object) | ||
{ | ||
return CComponentSystem::loadSerializable(object); | ||
} | ||
|
||
CEntity* CDecals::addDecal( | ||
const core::vector3df& position, | ||
const core::vector3df& dimension, | ||
const core::vector3df& normal, | ||
float textureRotation, | ||
float lifeTime, | ||
float distance) | ||
{ | ||
// References | ||
// https://sourceforge.net/p/irrext/code/HEAD/tree/trunk/extensions/scene/ISceneNode/DecalSystem | ||
|
||
CEntity* entity = createEntity(); | ||
|
||
CDecalData* decalData = entity->addData<CDecalData>(); | ||
decalData->Dimension = dimension; | ||
decalData->Normal = normal; | ||
decalData->TextureRotation = textureRotation; | ||
decalData->LifeTime = lifeTime; | ||
decalData->Distance = distance; | ||
|
||
CWorldTransformData* transform = (CWorldTransformData*)entity->getDataByIndex(CWorldTransformData::DataTypeIndex); | ||
transform->Relative.setTranslation(position); | ||
|
||
return entity; | ||
} | ||
|
||
void CDecals::bake() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
!@ | ||
MIT License | ||
Copyright (c) 2022 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 "Components/CComponentSystem.h" | ||
#include "Entity/CEntityHandler.h" | ||
|
||
namespace Skylicht | ||
{ | ||
class CDecals : public CEntityHandler | ||
{ | ||
protected: | ||
ITexture* m_texture; | ||
|
||
public: | ||
CDecals(); | ||
|
||
virtual ~CDecals(); | ||
|
||
virtual void initComponent(); | ||
|
||
virtual void updateComponent(); | ||
|
||
virtual CObjectSerializable* createSerializable(); | ||
|
||
virtual void loadSerializable(CObjectSerializable* object); | ||
|
||
inline void setTexture(ITexture* texture) | ||
{ | ||
m_texture = texture; | ||
} | ||
|
||
CEntity* addDecal( | ||
const core::vector3df& position, | ||
const core::vector3df& dimension, | ||
const core::vector3df& normal, | ||
float textureRotation, | ||
float lifeTime, | ||
float distance); | ||
|
||
void bake(); | ||
|
||
DECLARE_GETTYPENAME(CDecals); | ||
}; | ||
} |
64 changes: 64 additions & 0 deletions
64
Projects/Skylicht/Collision/Source/Decal/CDecalsRenderer.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
!@ | ||
MIT License | ||
Copyright (c) 2022 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 "CDecalsRenderer.h" | ||
|
||
namespace Skylicht | ||
{ | ||
CDecalsRenderer::CDecalsRenderer() | ||
{ | ||
|
||
} | ||
|
||
CDecalsRenderer::~CDecalsRenderer() | ||
{ | ||
|
||
} | ||
|
||
void CDecalsRenderer::beginQuery(CEntityManager* entityManager) | ||
{ | ||
|
||
} | ||
|
||
void CDecalsRenderer::onQuery(CEntityManager* entityManager, CEntity* entity) | ||
{ | ||
|
||
} | ||
|
||
void CDecalsRenderer::init(CEntityManager* entityManager) | ||
{ | ||
|
||
} | ||
|
||
void CDecalsRenderer::update(CEntityManager* entityManager) | ||
{ | ||
|
||
} | ||
|
||
void CDecalsRenderer::render(CEntityManager* entityManager) | ||
{ | ||
|
||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
Projects/Skylicht/Collision/Source/Decal/CDecalsRenderer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
!@ | ||
MIT License | ||
Copyright (c) 2022 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 "Entity/IRenderSystem.h" | ||
|
||
namespace Skylicht | ||
{ | ||
class CDecalsRenderer : public IRenderSystem | ||
{ | ||
protected: | ||
|
||
public: | ||
CDecalsRenderer(); | ||
|
||
virtual ~CDecalsRenderer(); | ||
|
||
virtual void beginQuery(CEntityManager* entityManager); | ||
|
||
virtual void onQuery(CEntityManager* entityManager, CEntity* entity); | ||
|
||
virtual void init(CEntityManager* entityManager); | ||
|
||
virtual void update(CEntityManager* entityManager); | ||
|
||
virtual void render(CEntityManager* entityManager); | ||
}; | ||
} |
Oops, something went wrong.