Win API ๊ธฐ๋ณธ ํ๋ ์ ์ํฌ ๊ตฌ์ฑ -> main.cpp -> System Class : Window ์์ฑ ๋ฐ Main Loop -> Input Class : ์ฌ์ฉ์ ์ ์ถ๋ ฅ -> DXEngine Class : Directx ์ฌ์ฉ
DirectX ์ด๊ธฐํ ๊ด๋ จ Class ์ถ๊ฐ -> main.cpp -> System Class -> Input Class -> DXEngine Class -> DXD3D : DirectX 11 ์ด๊ธฐํ
2์ฐจ์์์ ์ผ๊ฐํ ๊ทธ๋ฆฌ๊ธฐ / Model, Camera, Shader Class ์ถ๊ฐ -> main.cpp -> System Class -> Input Class -> DXEngine Class -> DXD3D Class : DirectX ์ด๊ธฐํ ๊ด๋ จ -> DXCamera Class : Camera ๊ด๋ จ -> DXModel Class : Model ์์ฑ ( Vertex, Index ) -> DXShader Class : Shader ๊ด๋ จ
2์ฐจ์์์ ์ผ๊ฐํ ์๊น ๋ฐ๊พธ๊ธฐ - ๋์ ๋ฆฌ์์ค ์ฌ์ฉ / MDParticle, DXPhysics ์ถ๊ฐ ์์ -> main.cpp -> System Class -> Input Class -> DXEngine Class -> DXD3D Class : DirectX ์ด๊ธฐํ ๊ด๋ จ -> DXCamera Class : Camera ๊ด๋ จ -> DXModel Class : Model ์์ฑ ( Vertex, Index ) -> MDParticle Class : ์ ์ ๊ด๋ จ ๊ตฌ์กฐ์ฒด -> DXShader Class : Shader ๊ด๋ จ -> DXPhysics Class : ๋ฌผ๋ฆฌ ์ฐ์ฐ ๊ด๋ จ
๊ฐ๋จํ ์กฐ๋ช ๋ง๋ค๊ธฐ - ๋์ ๋ฆฌ์์ค ์ฌ์ฉ / MDParticle, DXPhysics ์ถ๊ฐ ์์ -> main.cpp -> System Class -> Input Class -> DXEngine Class -> DXD3D Class : DirectX ์ด๊ธฐํ ๊ด๋ จ -> DXCamera Class : Camera ๊ด๋ จ -> DXModel Class : Model ์์ฑ ( Vertex, Index ) -> MDParticle Class : ์ ์ ๊ด๋ จ ๊ตฌ์กฐ์ฒด -> DXShader Class : Shader ๊ด๋ จ -> Light ์ ์ฉํ ์ ์๊ฒ ๋ณ๊ฒฝ -> DXPhysics Class : ๋ฌผ๋ฆฌ ์ฐ์ฐ ๊ด๋ จ -> DXLight Class : Diffuse Light, Light Position ์ค์ ๊ด๋ จ
-> ์กฐ๋ช ๊ด๋ จ
Normal Vector : ์ฃผ์ด์ง Object์์ ๋์ค๋ ๋ฐฉํฅ Light Vector : ๋น ๋ฒกํฐ Light Intensity : ์ฑ๋ -> Light Intensity = dot( Normal Vector * ( -1.0f ) , Light Vector ) -> ์ฃผ์ด์ง Object์ ๋น์ด ๊ฐํด์ง๋ ์ ๋ ( 0 ~ 1 )
Diffuse Light : ๋ถ์ฐ๊ด -> ๋ฌผ์ฒด์ ํ๋ฉด์์ ๋ถ์ฐ๋์ด ๋์ผ๋ก ๋ฐ๋ก ๋ค์ด์ค๋ ๋น -> ๊ฐ๋์ ๋ฐ๋ผ ๋ฐ๊ธฐ๊ฐ ๋ค๋ฆ -> Light Intensity -> Color = material Color * ( Light color * Light Intensity ) Ambient Light : ์ฃผ๋ณ๊ด -> ์๋ง์ ๋ฐ์ฌ๋ฅผ ๊ฑฐ์ณ์ ๊ด์์ด ๋ถ๋ถ๋ช ํ ๋น -> ๋ฌผ์ฒด๋ฅผ ๋ฎ๊ณ ์๋ ๋น์ด๋ฉฐ, ์ผ์ ํ ๋ฐ๊ธฐ์ ์์ ํํ -> Color = material Color * Ambient Light Color Specular Light : ๋ฐ์ฌ๊ด -> ๋ถ์ฐ๊ด๊ณผ ๋ฌ๋ฆฌ ํ๋ฐฉํฅ์ผ๋ก ์์ ํ ๋ฐ์ฌ๋๋ ๋น -> ๋ฐ์ฌ๋๋ ๋ถ๋ถ์ ํฐ์์ ๊ด์ผ๋ก ๋ณด์ Total Light : ์ค์ง์ ์ธ Object์ ๋น์ ๋ฐ๊ธฐ
3์ฐจ์ ๋ฐ์ค ๋ง๋ค๊ธฐ / MDParticle, DXPhysics ์ถ๊ฐ ์์ -> main.cpp -> System Class -> Input Class -> DXEngine Class -> DXD3D Class : DirectX ์ด๊ธฐํ ๊ด๋ จ -> DXCamera Class : Camera ๊ด๋ จ -> DXModel Class : Model ์์ฑ ( Vertex, Index ) -> MDParticle Class : ์ ์ ๊ด๋ จ ๊ตฌ์กฐ์ฒด -> DXShader Class : Shader ๊ด๋ จ -> Light ์ ์ฉํ ์ ์๊ฒ ๋ณ๊ฒฝ -> DXPhysics Class : ๋ฌผ๋ฆฌ ์ฐ์ฐ ๊ด๋ จ -> DXLight Class : Diffuse Light, Light Position ์ค์ ๊ด๋ จ
-> Normal Vector -> final Normal Vector = World Matrix * Normal Vector -> World๊ฐ ์ด๋ ํน์ ํ์ ํจ์ ๋ฐ๋ผ ์ต์ข Normal Vector๊ฐ ๋ฌ๋ผ์ง -> ์ด๋ฌํ Normal Vector๋ Light๋ก ํํ๋๋ Color์๋ ์ํฅ์ ๋ผ์นจ
๋ชฉ๋ก -> ํ๋ ์์ํฌ ์ฌ์ ์ -> ์ ๋ฐ์ฌ๊ด ์ถ๊ฐ -> ์ง์ง ๊ฐ๋จํ ๋น ๊ตฌํ -> ์์ง์ด๋ 3์ฐจ์ ๋ฐ์ค ๊ตฌํ -> ๊ฐ๋จํ ๊ธ์ ํ๋ฉด์ ์ถ๋ ฅ -> ์ฌ์ฉ์์ ๋ง์ฐ์ค ์ ๋ ฅ ๊ด๋ จ ๊ตฌํ
๊ตฌ์ฑ -> main.cpp -> SYSTEM -> DXENGINE -> DXD3D -> DXCAMERA -> DXMODEL -> DXLIGHT -> DXTEXT -> DXTEXTURE -> SUB -> SUBCPU -> SUBFPS -> SUBINPUT -> SUBLOG -> SUBTIMER
๋ด์ฉ -> main.cpp -> System - Window ์ด๊ธฐํ - MainLoop - DX, SUB ๊ด๋ฆฌ
-> DXENGINE
-> DXD3D
- DirectX ์ด๊ธฐํ
- Device, DeviceContext ๊ด๋ จ
- SwapChain, RenderTarget, DepthStencil, Blending ๊ด๋ จ
- World, Ortho, Projection Matrix & ViewPort ๊ด๋ จ
-> DXCAMERA
- Camera ์ด๊ธฐํ
- Camera Position, Rotation ๊ด๋ จ
- Camera View Matrix ๊ด๋ จ
-> DXMODEL
- Model ์ด๊ธฐํ
- Model Vertex, Index txt ํ์ผ ์ฝ๊ธฐ ๊ด๋ จ
- Load Model
- Image(texture) ๊ด๋ จ
- Load Texture
- Vertex, Index ๊ด๋ จ
- Update, Init
-> DXLIGHT
- Light ์ด๊ธฐํ
- Light ๋ฐฉํฅ ๋ฐ ๊ฐ ์ฑ์ง๋ค ์ค์
- Set ... & Get ...
-> DXL_SHADER
- Light Shader ์ด๊ธฐํ
- Light VS, PS hlsl ํ์ผ ์ฝ๊ธฐ ๊ด๋ จ
- Init ...
- Layout, SampleState, Buffer ๊ด๋ฆฌ
- Light Render ๊ด๋ฆฌ
-> DXTEXT
-> DXT_FONT
- Font ์ด๊ธฐํ
- Font DDS(texture), txt ํ์ผ ์ฝ๊ธฐ ๊ด๋ จ
- Load DDS & txt
- ์ฃผ์ด์ง Text์ Vertex, Index ํ์ฑ ๊ด๋ จ
- BuildVertexArray
-> DXT_SHADER
- Font Shader ์ด๊ธฐํ
- Font VS, PS hlsl ํ์ผ ์ฝ๊ธฐ ๊ด๋ จ
- Init ...
- Layout, SampleState, Buffer ๊ด๋ฆฌ
- Font Render ๊ด๋ฆฌ
-> DXTEXTURE
- Texture ํ์ผ ์ฝ๊ธฐ
- Texture ํ์ผ ๋ด์ฉ ์ ํด์ฃผ๊ธฐ
-> SUB
-> SUBCPU - CPU ์ฌ์ฉ๋ ๊ณ์ฐ
-> SUBFPS - FPS ๊ณ์ฐ
-> SUBINPUT - User Input ๊ด๋ฆฌ
-> SUBLOG - Log ์ถ๋ ฅ ๋์ฐ๋ฏธ
-> SUBTIMER - Time ๊ณ์ฐ
--> DXTEXT์์ Sentence ์์ฑ & Update ๊ด๋ จํ์ฌ ๋ฐ์ ๋ด์ฉ ๊ณต๋ถํ์ ๋งค๊ฐ๋ณ์(parameter)์ ์ธ์(argument) -> ํจ์ -> ์ธ์(argument)๊ฐ ๋งค๊ฐ๋ณ์(parameter)์ ์ ๋ฌ๋๋ ํํ๋ก ๋์
ex)
void func( int a, int b )
{
...
}
int main()
{
func( 1, 2);
...
}
ํจ์๊ฐ ํธ์ถ๋๊ฒ ๋๋ฉด,
int x = 1;
int y = 2;
์ ๊ฐ์ด ์ธ์๊ฐ ๋งค๊ฐ๋ณ์์ ์ ํด์ง
์ธ์ ์ ๋ฌ
-> ๊ฐ์ ์ํ ์ ๋ฌ
-> ํจ์์ ์ง์ญ๋ณ์์ด๋ ๋งค๊ฐ๋ณ์๋ก ์ธ์์ ๊ฐ ๋ณต์ฌ
-> ํจ์ ํธ์ถ์ด ๋๋๋ฉด ์ธ์์ ๊ฐ ๋ณํ X
-> call by value ๋ผ๊ณ ๋ถ๋ฆ
-> ์ฐธ์กฐ์ ์ํ ์ ๋ฌ
-> ๋งค๊ฐ๋ณ์๋ก ์ ํด์ง๋ ์ธ์์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๊ณต์
-> ๋งค๊ฐ๋ณ์์ ์ธ์์ ์ฃผ์ ๋์ผ
-> ํจ์ ํธ์ถ์ด ๋๋๋ฉด ์ธ์์ ๊ฐ ๋ณํ O
-> C/C++์ return์ด ํ๋๋ง ๊ฐ๋ฅํ๊ธฐ์, ์ด์ ๋ฐฉ๋ฒ์ ์ฃผ๋ก ์ฌ์ฉ
-> ์ฐธ์กฐ ๋ฐฉ์
-> ์ผ๋ฐ & : L-value( ๋ฉ๋ชจ๋ฆฌ ๊ณต๊ฐ O )
-> const & : L-value, R-value( ๋ฉ๋ชจ๋ฆฌ ๊ณต๊ฐ X )
-> ์ฃผ์์ ์ํ ์ ๋ฌ
-> ๊ฐ์ด ์ฃผ์๊ฐ์ผ๋ก ๋ฐ๋๋ค๊ณ ์๊ฐํ๋ฉด ๋๋ค
-> ๊ฐ์ ์ฐธ์กฐ๋ฅผ ํตํ์ฌ ์ธ์์ ๊ฐ ๋ณ๊ฒฝ ๊ฐ๋ฅ
-> ์ธ์์ ์ฃผ์๊ฐ์ ๋งค๊ฐ๋ณ์๊ฐ ์ง๋๊ณ ์๊ณ
-> ๋งค๊ฐ๋ณ์์ ์ญ์ฐธ์กฐ๋ฅผ ํตํ์ฌ ์ธ์๋ก ์ ๊ทผํ์ฌ ๊ฐ ๋ณ๊ฒฝ ๊ฐ๋ฅ
FPS, CPU ํ๋ฉด์ ์ถ๋ ฅ
๊ตฌ์ฑ -> main.cpp -> SYSTEM -> DXENGINE -> DXD3D -> DXCAMERA -> DXMODEL -> DXLIGHT -> DXTEXT -> DXTEXTURE -> SUB -> SUBCPU -> SUBFPS -> SUBINPUT -> SUBLOG -> SUBTIMER
์ง๋ฉด๊ณผ์ ์ถฉ๋ ๊ตฌํ -> 3์ฐจ์์์ ๊ฐ์ฒด ์ถฉ๋ ๊ตฌํ -> CCW(Counter Clockwise) ์๊ณ ๋ฆฌ์ฆ -> Object - Normal Vector์ ๋ฐ๋ผ Plane์ ๊ฐ์ ์ค์ - ์ด Plane * Plane์ ์ ๋ถ ๊ฐ์ - ex) ์ง์ก๋ฉด์ฒด 2๊ฐ ์ถฉ๋ ๋น๊ต ๊ฐ๊ฐ์ Plane์ ๊ฐ์ : 6๊ฐ ๊ฐ Plane์ ์ ๋ถ์ ๊ฐ์ : 4๊ฐ ์ด ๊ณ์ฐ๋ : 646*4 -> ๋งค์ฐ ๋ง์์ง๋ค
- ์๋ก ๋ค๋ฅธ Object๋ผ๋ฆฌ Normal Vector์ ๋ด์ ์ด ์์์ธ ๊ฒฝ์ฐ๋ผ๋ฆฌ ์ถฉ๋ ๊ฐ๋ฅ
> ์์, 0, ์์ ์
๋ค ๊ณ์ฐํ๊ฒ ๋ ์, ๊ณ์ฐ๋์ด ๋๋ฌด ๋ง์์ง
> ์ถฉ๋ ์, Normal Vector๋ฅผ ์ ํ๋ ๊ธฐ์ค์?
-> mappedResource๋ฅผ ๋ถ๋ฌ์์, Vertex์ Index์ memcpy๋ฅผ ์ํจ๋ค.
-> Output Buffer๋ฅผ ์ฌ์ฉํ์ฌ์ Input Buffer๋ฅผ ํตํด์ ์ต์ข
์์ฑ๋ Output Buffer๋ฅผ ์ป๋๋ค
ex memcpy( List, mappedResource.pData , sizeof( Type ) * Count )
๋์ ๋ฆฌ์์ค๋ฅผ ์งํํ๋ ํ์์ ๋ฐ๋๋ผ๊ณ ์๊ฐํ๋ฉด ๋๋ค.
๋ฆฌ์์ค์ ๋ํ ๋ณํ์ ์๋ค
-> ๊ฐ์ฒด์ ์ด๋
-> Vertex์ ๋ณํ
-> Particle์ด ์๋ ์ด์, ํ๋์ Object์ ์๋ง์ Vertex์ Index๊ฐ ์กด์ฌ
-> World์ ๋ณํ
-> World์ ๋ณํ์ ์ฌ์ฉํด์ผ
-> ํ๋์ Model์ ๋ํ ๋ค์ํ ๋ฌผ์ฒด๋ค์ ๋จ์ํ World๋ฅผ ์ถ๊ฐํจ์ผ๋ก ๊ตฌํํ ์ ์์
-> ์ถํ์ Model List ํ์
-> Model List์์ ์์ ์ผ๋ก๋ถํฐ Hit Box ๋ฒ์ ์์ ์๋ Model๋ค๋ง ์ถฉ๋ ํ
์คํธํ ์ ์๋๋ก ์๊ณ ๋ฆฌ์ฆ ๊ตฌํ ํ์
-> Vertex Shader์ Output Vertex ๊ฐ์ ธ์ค -> D3D11_BIND_FLAG -> D3D11_BIND_VERTEX_BUFFER IA ๋จ๊ณ์์ Binding -> D3D11_BIND_INDEX_BUFFER IA ๋จ๊ณ์์ Binding -> D3D11_BIND_CONSTANT_BUFFER Shader ๋จ๊ณ์์ Binding -> D3D11_BIND_SHADER_RESOURCE Shader ๋จ๊ณ์์ Binding -> D3D11_BIND_STREAM_OUTPUT Stream Output ๋จ๊ณ์์ ์ถ๋ ฅ ๋ฒํผ ๋ฐ์ธ๋ฉ -> D3D11_BIND_RENDER_TARGET Output Merge ๋จ๊ณ์์ ๋ ๋๋ง ๋์ ๋ฐ์ธ๋ฉ -> D3D11_BIND_DEPTH_STENCIL Output Merge ๋จ๊ณ์์ ๊น์ด ์คํ ์ค ๋ฐ์ธ๋ฉ -> D3D11_BIND_UNORDERED_ACCESS ์์๊ฐ ์ง์ ๋์ง ์์ ์ก์ธ์ค ๋ฆฌ์์ค -> D3D11_BIND_DECORDER ๋์ฝ๋ API -> D3D11_BIND_VIDEO_ENCODER ๋น๋์ค API
[ 2023-03-18 ]
template< class T >
#include
class ResourceManager {
template< class T >
static void CreateMap()
{
m_ResourceData[ &typeid( T ) ] = std::map< std::string, IResource* >();
}
template< class T >
static void CreateResource( std::string Name )
{
UUID Id;
IResource* Temp = new T( Name, ID );
m_ResourceData[ typeid(T).name() ][ ID ] = Temp;
}
template< class T >
static T* GetResource( std::string ID )
{
return (T*)m_ResourceData[ typeid(T).name()][ ID ];
}
template< class T >
static std::map< std::string, IResource* > > GetMap()
{
return m_ResourceData[ typeid(T).name() ];
}
std::map< std::string, std::map< std::string, IResource* > > m_ResourceData;
std::map< const type_info&, std::map
};
class ResourceGuiLayer { template< class T > void RenderTree() { if ( ImGui::TreeNode( typeid(T).name().c_str() ); for ( auto itr = ResourceManager::GetMap().begin(); itr != ResourceManager::GetMap().end(); itr++ ) { if ( ImGui::Selectable( itr->GetName().c_str() ) ) { m_PropertyGuiLayer->Render( (T*)itr ); } } ImGui::PopNode(); } }
class PropertyGuiLayer { void RenderCommon( IResource* Resource ) { ImGui::Text( Resource->GetName().c_str() ); ImGui::Text( Resource->GetID().c_str() ); ImGui::Text( Resource->GetType().c_str() ); }
void RenderProperty( Scene* Resource )
{
...
}
void RenderProperty( Component* Resource )
{
...
}
...
template< class T >
void Render( T* Resource )
{
RenderCommon();
RenderProperty( Resource );
}
->> SettingGuiLayer, FileSystemGuiLayer์ฒ๋ผ Begin๊ณผ End๋ก ๊ตฌํํ๊ธฐ
}
-
Done
class IResource { std::string m_Name; std::string m_UUID; };
[ 2023-03-21 ]
- Input New Object GuiLayer ->(Change) IGuiLayer
IBrowserGuiLayer <-(Inheritance) IGuiLayer
MenuBrowserGuiLayer <-(Inheritance) IBrowserGuiLayer ->> MainGuiLayer
PropertyBrowserGuiLayer <-(Inheritance) IBrowserGuiLayer ->> PropertyGuiLayer
FileBrowserGuiLayer <-(Inheritance) IBrowserGuiLayer ->> FileSystemGuiLayer
ProjectManager ->> Manager Yaml File
-
File Browser system -> IBrowserGuiLayer ->> Menu ... ( MenuBrowserGuiLayer ) ->> Property ... ( PropertyBrowserGuiLayer )
Click selectable for button like "File Load", then, Begin FileBrowserGuiLayer
-> FileBrowserGuiLayer Render files and user select path ... As result, user click "Done" button, then call IBrowserGuiLayer end
-> MenuBrowserGuiLayer if it is called by FileBrowserGuiLayer, Call ProjectManager
-> PropertyBrowserGuiLayer if it is called by FileBrowserGuiLayer, Call Resource's Compile( FS::path Path ) function
-
Change Resource System -> ResourceManager - Resource must be accessed by ResourceManager, because, the other method is existed that access to resource, the other method must copy resource's pointer data and the other method must overlap ResourceManager
-> Scene - It has map data structure that has typeinfo and UUID vector
-> Component - It has map data structure that has typeinfo and UUId vector
[ 2023-04-01 ] class SceneManager { private : SceneManager() {}; ~SceneManager() {};
public : void Init() {}; void Destroy() {};
static std::vector< Scene >& GetScenes()
{
return m_SceneManager.m_SceneData;
}
static void SetScene( Scene Other )
{
m_SceneManager.m_SceneData.push_back( Other );
}
private : static SceneManager m_SceneManager; std::vector< Scene > m_SceneData; };
class RenderSystem; class CollisionCheckSystem;
class Scene { public : Scene() {}; ~Scene() {};
public :
void Init()
{
R
}
void RegitserEntity( Entity& OtherEntity )
{
}
void RegisterComponent( Component& OtherComponent )
{
}
void RegisterSystem( System& OtherSystem )
{
}
void OnUpdate()
{
}
};
class Entity { public : Entity() {}; virtual ~Entity(){};
public :
virtual void Update() = 0;
};
struct Component {
};
class System { public : System() {}; virtual ~System() {};
public :
virtual void Init() = 0;
virtual void Update() = 0;
};
struct Transformation { XMFLOAT3 Position; XMFLOAT3 Rotation; XMFLOAT3 Scale; };
struct FilePath { FS::path Path; };
struct Mesh { VertexBuffer; IndexBuffer; };
struct Renderable { Trnasformation* m_Transform; Mesh* m_Mesh; };
[ 2023-04-07 ]
// Component๋ค struct IDComponent { MyUUID ID; };
struct TagComponent { std::string Name; };
struct TransformComponent {
};
// Entity ๊ฐ์ฒด class Entity { public :
public :
void AddComponent();
};
// Node๋ค struct RenderableNode {
};
struct CameraNode {
};
struct LightNode {
};
// System๋ค class RenderingSystem {
};
[ 2023-04-09 ]
Entity -> Component์ ๋ํ ์ฃผ์๋ค์ ์ง๋๊ณ ์์ -> ๋จ์ํ, Component๋ค์ ๋ฑ๋ก ๋ฐ ํด์ ํ ์ ์์
Component -> ํน์ฑ๋ค์ ์ง๋๊ณ ์์
Node -> Archtype์ด๋ผ๊ณ ์๊ฐํ๋ฉด ๋ ๋ฏ -> System์ผ๋ก ๋๊ฒจ์ผ ๋๋, ๊ฐ Entity์ ๋ฐ๋ฅธ Component๋ค์ ๋ฌถ์์ด๋ผ๊ณ ์๊ฐ -> Component์ ๋ํ ์ฃผ์๋ค์ ์ง๋๊ณ ์์ -> Entity์ ์ํ ์์ Entity๋ผ๊ณ ์๊ฐํ๋ฉด ๋ ๋ฏ
Scene ( Entity Manager ) -> Entity๋ค์ ๊ด๋ฆฌ -> Entity ์์ฑ ๋ฐ ์ญ์
Component Manager -> Component๋ค์ ์ค์ ์ธ์คํด์ค๋ค์ ์ ์ฅ -> Component๋ค์ ์์ฑ ๋ฐ ์ญ์
Node Manager -> Node๋ค์ ์ค์ ์ธ์คํด์ค๋ค์ ์ ์ฅ -> Node๋ค์๊ฒ ํด๋น Entity๋ค์ ๋๊ฒจ์ฃผ๋ ์ญํ ( Scene์์ ๋ฐ์์ด )
์๋ฌธ์ 1. Entity๋ค์ ์ด๋ป๊ฒ ํด์ ์์ ์ด ๊ฐ์ ธ์ผ ํ Node๋ค์ ์ ๋ณด๋ฅผ ์ ์ ์์ง? 1.1 ์ฌ์ฉ์๊ฐ ์ค์ ํ ์ ์๋๋ก ํด์ผํ๋ค. 1.2 ํด๋น Entity๊ฐ ์ด๋ค Node๋ค์ ๊ฐ์ง๊ณ System์ ์ฐ๊ฒฐํ ์ง ์ด๋ป๊ฒ ํ ๊ฒ์ธ๊ฐ? 1.3 Proj ํ์ผ ์์์ ํด๋น Entity๋ค์ด ์ด๋ค Node๋ค์ ์ฐ๊ฒฐ์ด ๋ ์ง ๋ํ๋ผ ์ ์๋ค. 2. ํด๋น Node๋ค๊ณผ System๋ค์ ๋ณดํต์ 1๋1๋ก ๋งค์นญ์ํค์
3. Blue Print์ฒ๋ผ Node๋ค์ ์ฐ๊ฒฐ์ํฌ ์ ์๋ Visual Graph๋ฅผ ๊ตฌํํ๋ ๊ฒ์ด ์ข์๊น?
3.1 ์ฐ๊ฒฐ์ ๋ํ ์ ๋ณด๋ Proj ํ์ผ์ ๋ค์ด๊ฐ ์๋๋ก ๊ตฌํ์ ํด๋ณด์
3.2 ๋ง์ฝ์ ์ฐ๊ฒฐ์ ์ง์ ํด์ผํ๋ค๋ฉด ์ด๋ป๊ฒ ํด์ผํ ๊น?
3.3 Visual Graph๊ฐ ์์ ๋๋ ์ด๋ค์์ผ๋ก ๊ตฌํํ ์ง ์๊ฐ์ ํด๋ณด์.
[ 2023-04-10 ]
- ์ฐจ์ธ๋ Unit์ ๊ธฐ๋ฐ ๊ธฐ์
- Data Oriented Design( DOD ) ์ผ๋ก์ ์ ํ
- ECS, Job System. Burst Compiler ์ธ๊ฐ์ง ์์์ ํฉ
- ๋ณต์กํ ์ฝ๋์์ด ๊ฐ๋จํ๊ฒ Multi-Threading์ด ๊ฐ๋ฅ
- ๋น๋ ์ต์ ํ๋๋ก ํผ๋ชจ๋จผ์ค ํฅ์
-> DOD๋ฅผ ์ํด ์ ๊ณต๋๋ ์ํคํ
์ณ
-> Entity๋ ๋ฐ์ดํฐ๋ฅผ ๊ฐ๋ฆฌํค๋ ์ธ๋ฑ์ค
-> Component๋ ์ฝ๊ณ ์ฐ๊ธฐ ์ํ ๋ฐ์ดํฐ
-> System์์ Entity์ Component๋ฅผ ๊ฐ์ง๊ณ ๋ก์ง์ ๊ตฌํ
-> Entity์ Component๋ง ์๋ค๋ฉด ์๋ฌด ์ผ๋ ์ผ์ด๋์ง ์์
-> Multi-Threading์ ๊ฐ๋ฅํ๊ฒ ํ๋ ์์คํ
-> Race Condition ๊ฑฑ์ ์์ด Threading ๊ตฌํ์ด ๊ฐ๋ฅ
-> ์ฝ๋์์ ์ด๋ฆ์ Job Component System
-> Job๋ค์ ์์ฑํ๊ณ ์์กด์ฑ์ ๋ํ Handle์ ๋ฐํ
-> ์์
๋ฐฉ์์ ๋ฐ๋ผ ์ฌ๋ฌ ํํ์ Job์ ์ ๊ณต
#1. Entity -> ID๋ค์ ์ง๋๊ณ ์๋ค. -> Component๋ค์ ๋ํ ํฌ์ธํฐ๋ฅผ ์ง๋๊ณ ์๋ค.
#2. Component -> ์ค์ ์ Attribute๋ค์ ์ง๋๊ณ ์๋ค.
#3. Node -> ํด๋น๋ Entity์ ID๋ฅผ ๋ฑ๋กํ๋ค -> Component๋ค์ ํฌ์ธํฐ๋ฅผ ์ง๋๊ณ ์๋ค. -> Node๋ค์ ์ด๋ป๊ฒ ํด์ Caching Hit๋ฅผ ๋์ผ์ง๋ ๋์ค์ ์๊ฐ์ ํด๋ณด์.
#4. System -> ํ์๋ก ํ๋ Node๋ค์ ๊ฐ์ง๊ณ Update๋ฅผ ์งํํ๋ค.
struct Component { // attribute for entities };
class Entity { // Register Component; // Make Entity ID; };
struct Node { // This is component collection };
[ 2023-04-11 ]
#1. Map ๊ตฌ์กฐ -> Component Manager Key : Component Type ์ ๋ณด Value : std::any -> std::vector< Type > -> std::any_cast ๋ฅผ ์ฌ์ฉํด์ ๊ตฌํ์ ํด๋ณด์.
or C++17 ์ดํ์์ ํธํ์ฑ์ ์ํด์
Value : void*
-> std::vector< Type >
-> Entity
Key : Component Type ์ ๋ณด
Value : void*
-> Scene
Key : MyUUID
Value : Entity
-> Scene Manager
Key : MyUUID
Value : Scene
-> Node Manager
Key : Node Type ์ ๋ณด
Value : std::any
-> std::vector< Type >
or C++17 ์ดํ์์ ํธํ์ฑ์ ์ํด์
Value : void*
-> std::vector< Type >
ํ์ง๋ง ์ด๋ฏธ typeinfo๋ฅผ ์ฌ์ฉํด์ C++17 ์ด์๋ง ์ฌ์ฉ๊ฐ๋ฅํ ๊ฒ ์๋๊ฐ?
-> void* reinterpret_cast vs std::any
-> reinterpret_cast ํฌ์ธํฐ ๊ฐ์ ํ๋ณํ
-> ์๋ชป๋ ๋ณํ์ผ ๋์ ๊ฒฝ์ฐ, ๋ง์์ฃผ๋ ๊ฒ์ด ์๋ค.
-> std::any
-> ์๋ชป๋ ๋ณํ์ผ ๋, ๋ง์์ค ์ ์๊ฒ ํด์ค๋ค.
-> map ์์ฒด๋ ๊ทธ๋ฅ 48 ๋ฐ์ดํธ์ ํฌ๊ธฐ๋ฅผ ์ง๋๋ค.
์ค์ map ๊ฐ์ฒด ์ ์ฒด์ ๋ฐ์ดํฐ์ ํฌ๊ธฐ๋
Key + Value * map pair ๊ฐ์ + map instance ์ฌ์ด์ฆ์ด๋ค.
pair ๋ฐ์ดํฐ์ ๊ฒฝ์ฐ์๋ Heap์ ์ ์ฅ๋๊ณ ( ๋์ )
map ๊ฐ์ฒด ์์ฒด์ด ๊ฒฝ์ฐ์๋ Stack์ ์ ์ฅ( ์ ์ )
์ต ๋๋ฌธ์, map ๊ฐ์ฒด ์์ฒด์ ๋ํ ์ฌ์ด์ฆ๋ 48๋ก ์ผ์ ํ ์ ๋ฐ์ ์๋ค.
-> Layer๋ค์ ๊ฒฝ์ฐ์๋ Component์ ๋ฐ๋ผ์ Rendering ํด์ฃผ๋ Property Layer๊ฐ ์กด์ฌํ๊ณ
-> Scene๋ค์ ๋ค๋ฃจ๋ Scene Layer
-> Log๋ค๋ง์ ์ฃผ๋ก ๋ค๋ฃจ๋ Log Layer
-> Main Menu Layer๊ฐ ์กด์ฌํ๊ฒ ๋๋ค.
Entity -> ID -> Component's Pointer
Node -> Id -> Component's Pointer
Componen Manager -> Type Component Instance
Node Manager -> Type Node Instance
Scene -> ID -> Entity Instance
[ 2023-04-12 ]
-> ID
-> Components' Pointer
-> ID
-> Components' Pointer
-> Each Type of Component Instance
-> std::any or void* : std::vector
-> Each Type of Node Instance
-> std::any or void* : std::vector
-> ID
-> Entities' Instance
-> Scenes' Instance
-> The Function uses some type of Node
-> The System Needs very complex, and
each system cannot contact each other,
just connect through node
-> Systems' Instance
-> Register System
-> Systems must be inheritance ISystem that has init,set and frame function's interface
-> System Manager set sequence of System on frame
# ISystem
-> That is the interface of system
-> This Object has some pointer of prev, next ISystem.
-> Cause, System must have seqeunce during frame animation
-> For example, Collision Animation has first collision System,
Second CalculatePhysicsSystem, lastly RenderSystem.
-> So, if this sequence is linked list, the User using this engine,
more easily edit sequence, some system input or delete ...
and, user can see thie sequence on game engine ui.
So, the User drag some system for inputting this sequence,
just, connect prev system and next system.
[ 2023-05-10 ]
0. Global Variable ( static variable )
-> This Object is static variable
-> This Object is global variable
1. Handler
-> Manage without Entity, Component, Node, System, Scene
-> Manage Asset, Files ... etc
2. Manager
-> Manage Entity, Component, Node, System, Scene
3. ECS( Entity Component System )
-> Entity
-> Connection of Components
-> This object must have unique number that is called as UUID
-> Component
-> This object is actial data
-> System
-> This object is acting
-> This object run using Node or Component
-> Node
-> This object is unrealitic data's or data's connection by entity
-> Scene
-> This object is connection of Entities.
0. Global Variable ( static variable )
0.1 Core
0.1.1 Core
0.1.2 Log
0.1.3 Timer
0.2 API
0.2.1 WinAPI
0.2.2 DirectXAPI
0.2.3 ImGuiAPI
0.3 Handler
0.4 Manager
1. Handler
1.1 AssetHandler
1.2 FileHandler
2. Manager
2.1 SceneManager
2.2 Scene( EntityManager )
2.3 ComponentManager
2.4 NodeManager
2.5 SystemManager
3. ECS ( Entity Component System )
3.1 Entity
3.2 Component
3.3 System
3.4 Node
3.5 Scene ( Entity Manager )
[ 2023-05-11 ]
1. Make Entity
2. Add Entity
3. Remove Entity
1. Make Component
2. Add Component
3. Remove Component
1. Make Node through Entity's ID
2. Add Node through Entity's ID
3. Remove Node through Entity's ID
1. Add Component -> Through ComponentManager
2. Make Component -> Through ComponentManager
3. Give Entity's ID
4. Give Entity's Name
1. Render Entity's Component -> Through NodeManager;
2. Edit Entity's Component -> Through NodeManager;
3. Render Array of Entity's Node -> Through NodeManager;
4. Edit Entity's Node -> Through NodeManager;
5. Render Scene's System -> Through SystemManager;
6. Edit Scene's System Sequence -> Through SystemManager;
1. Open Project File -> Through FileHandler + YAML
2. Save Project File -> Through FileHandler + YAML
3. Make Scene, Component, Node -> Through Scene, Component, Node Manager
4. Register System -> Through SystemManager
1. Select Scene -> Through SceneManager
2. Make Scene -> Through SceneManager
3. Remove Scene -> Through SceneManager
4. Select Entity -> Through Scene
4.1. Send Entity's ID to Property UI
5. Make Entity -> Through Scene
6. Remove Entity -> Through Scene
1. Print Log -> Through Log
2. Save Log File -> Through AssetHandler
[ 2023 - 05 - 13 ]
1. The entity, node have some components that they need
2. The Component Manager has each type of Component's Vector
3. These Vector reallocate when user input Component
4. Then, entity and node would miss pointer of their Component
1. Using Index of Component Vector, instead Pointer
1.1 Entity and Node just have index for each Component
1.2 Through ComponentManager, Node gives information of index's Component Vector to each System.
1.3 Node get information of index's Component through entity's Instance.
[ 2023 - 05 -18 ]
1. Using Interface, user easily make Instance.
2. The origin method is just making instance using std::any with vector.
So, the program must change type of std::any using std::any_cast.
3. This is very useful in advanced game engine's memory manager.
1. Each type of object vector or list just have memory pool address or register memory pool.
2. Then, user can access each type of memory pool, get continuously data in memory.
3. But, if the vector's data count of allocating data is over then memory pool size.
4. the program must allocate new memory pool and connect the origin pool.
1. The inheritance relationship using interface and instance, can access through interface's pointer to instance
2. The Manager like System, Node, Component have the method function
like, Create, Get, Delete.
3. The original method functions only access through template typename T each type's vector.
4. But, this needs the program is created by hard coding for suitable each type.
5. So, this needs the user input new type of system or node or component,
change the original code.
6. The changine the original core code is so difficult.
7. I want to just use the Outter code in my game engine.
8. So, the Managers of System, Component, Node have two type of eacy method functions for typeid and template
9. But, template method function is constructed by typeid method function.
## WebSite : https://github.com/talhacali/ECS
1. Using Memory Manager, this object allocate memory.
2. This object has memory's pointer by each type.
3. The ECS manager create their object through memory manager.
4. The ECS manager just have pointer of each object.
So, just use vector or map.