Refactoring
This commit is contained in:
parent
6be2fc5554
commit
864b0d60b9
@ -2,10 +2,6 @@ Entities:
|
|||||||
- ID: 0
|
- ID: 0
|
||||||
Name: Light
|
Name: Light
|
||||||
Components:
|
Components:
|
||||||
Transform:
|
|
||||||
Position: [-1.6726234, -0.228918433, 0.638042808]
|
|
||||||
Rotation: [1.5, 2.70000005, 342.5]
|
|
||||||
Scale: [1, 1, 1]
|
|
||||||
Light:
|
Light:
|
||||||
Type: 0
|
Type: 0
|
||||||
Intensity: 1
|
Intensity: 1
|
||||||
@ -16,29 +12,37 @@ Entities:
|
|||||||
cutOff: 0
|
cutOff: 0
|
||||||
outerCutOff: 39.7900009
|
outerCutOff: 39.7900009
|
||||||
Direction: [-0.200000003, -1, -0.300000012]
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
Transform:
|
||||||
|
Position: [-1.6726234, -0.228918433, 0.638042808]
|
||||||
|
Rotation: [1.5, 2.70000005, 342.5]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
- ID: 1
|
- ID: 1
|
||||||
Name: Cube
|
Name: Cube
|
||||||
Components:
|
Components:
|
||||||
|
Render:
|
||||||
|
MeshName: model
|
||||||
|
Color: [1, 1, 1]
|
||||||
Transform:
|
Transform:
|
||||||
Position: [0, 0, 0]
|
Position: [0, 0, 0]
|
||||||
Rotation: [0, -166.600006, 0]
|
Rotation: [0, -166.600006, 0]
|
||||||
Scale: [0.100000001, 0.100000001, 0.100000001]
|
Scale: [0.100000001, 0.100000001, 0.100000001]
|
||||||
Render:
|
|
||||||
MeshName: model
|
|
||||||
Color: [1, 1, 1]
|
|
||||||
- ID: 2
|
- ID: 2
|
||||||
Name: Environment
|
Name: Environment
|
||||||
Components:
|
Components:
|
||||||
Render:
|
|
||||||
MeshName: WhiteCube
|
|
||||||
Color: [1, 1, 1]
|
|
||||||
Transform:
|
Transform:
|
||||||
Position: [0, 0, 0]
|
Position: [0, 0, 0]
|
||||||
Rotation: [0, 0, 0]
|
Rotation: [0, 0, 0]
|
||||||
Scale: [18.7000008, 7.4000001, 10]
|
Scale: [18.7000008, 7.4000001, 10]
|
||||||
|
Render:
|
||||||
|
MeshName: WhiteCube
|
||||||
|
Color: [1, 1, 1]
|
||||||
- ID: 3
|
- ID: 3
|
||||||
Name: LightBlue
|
Name: LightBlue
|
||||||
Components:
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [0, 1.8090117, 3.07234383]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
Light:
|
Light:
|
||||||
Type: 0
|
Type: 0
|
||||||
Intensity: 2
|
Intensity: 2
|
||||||
@ -49,13 +53,13 @@ Entities:
|
|||||||
cutOff: 12.5
|
cutOff: 12.5
|
||||||
outerCutOff: 17.5
|
outerCutOff: 17.5
|
||||||
Direction: [-0.200000003, -1, -0.300000012]
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
Transform:
|
|
||||||
Position: [0, 1.8090117, 3.07234383]
|
|
||||||
Rotation: [0, 0, 0]
|
|
||||||
Scale: [1, 1, 1]
|
|
||||||
- ID: 4
|
- ID: 4
|
||||||
Name: LightRed
|
Name: LightRed
|
||||||
Components:
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [-2.94120026, 1.60229158, -1.5770874]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
Light:
|
Light:
|
||||||
Type: 0
|
Type: 0
|
||||||
Intensity: 1
|
Intensity: 1
|
||||||
@ -66,20 +70,16 @@ Entities:
|
|||||||
cutOff: 12.5
|
cutOff: 12.5
|
||||||
outerCutOff: 17.5
|
outerCutOff: 17.5
|
||||||
Direction: [-0.200000003, -1, -0.300000012]
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
Transform:
|
|
||||||
Position: [-2.94120026, 1.60229158, -1.5770874]
|
|
||||||
Rotation: [0, 0, 0]
|
|
||||||
Scale: [1, 1, 1]
|
|
||||||
- ID: 5
|
- ID: 5
|
||||||
Name: Camera
|
Name: Camera
|
||||||
Components:
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [-4.12095118, 0.57130301, -1.16569459]
|
||||||
|
Rotation: [0, 106.199997, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
Camera:
|
Camera:
|
||||||
Zoom: 10
|
Zoom: 10
|
||||||
FOV: 45
|
FOV: 45
|
||||||
Orthographic: false
|
Orthographic: false
|
||||||
NearPlane: 0.100000001
|
NearPlane: 0.100000001
|
||||||
FarPlane: 1000
|
FarPlane: 1000
|
||||||
Transform:
|
|
||||||
Position: [0, 0, 0]
|
|
||||||
Rotation: [0, 26.2000008, 0]
|
|
||||||
Scale: [0.100000001, 0.100000001, -0.100000001]
|
|
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -72,6 +72,10 @@
|
|||||||
"mutex": "cpp",
|
"mutex": "cpp",
|
||||||
"semaphore": "cpp",
|
"semaphore": "cpp",
|
||||||
"stop_token": "cpp",
|
"stop_token": "cpp",
|
||||||
"thread": "cpp"
|
"thread": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"unordered_set": "cpp",
|
||||||
|
"shared_mutex": "cpp",
|
||||||
|
"typeindex": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
85
assets/Example_House.polys
Normal file
85
assets/Example_House.polys
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
Entities:
|
||||||
|
- ID: 0
|
||||||
|
Name: Light
|
||||||
|
Components:
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 1
|
||||||
|
Color: [0, 1, 0]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0.0900000036
|
||||||
|
Quadratic: 0.0320000015
|
||||||
|
cutOff: 0
|
||||||
|
outerCutOff: 39.7900009
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
Transform:
|
||||||
|
Position: [-1.6726234, -0.228918433, 0.638042808]
|
||||||
|
Rotation: [1.5, 2.70000005, 342.5]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
- ID: 1
|
||||||
|
Name: Cube
|
||||||
|
Components:
|
||||||
|
Render:
|
||||||
|
MeshName: model
|
||||||
|
Color: [1, 1, 1]
|
||||||
|
Transform:
|
||||||
|
Position: [0, 0, 0]
|
||||||
|
Rotation: [0, -166.600006, 0]
|
||||||
|
Scale: [0.100000001, 0.100000001, 0.100000001]
|
||||||
|
- ID: 2
|
||||||
|
Name: Environment
|
||||||
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [0, 0, 0]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [18.7000008, 7.4000001, 10]
|
||||||
|
Render:
|
||||||
|
MeshName: WhiteCube
|
||||||
|
Color: [1, 1, 1]
|
||||||
|
- ID: 3
|
||||||
|
Name: LightBlue
|
||||||
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [0, 1.8090117, 3.07234383]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 2
|
||||||
|
Color: [0, 0, 1]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0
|
||||||
|
Quadratic: 0.200000003
|
||||||
|
cutOff: 12.5
|
||||||
|
outerCutOff: 17.5
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
- ID: 4
|
||||||
|
Name: LightRed
|
||||||
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [-2.94120026, 1.60229158, -1.5770874]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 1
|
||||||
|
Color: [1, 0, 0]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0.0900000036
|
||||||
|
Quadratic: 0.0320000015
|
||||||
|
cutOff: 12.5
|
||||||
|
outerCutOff: 17.5
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
- ID: 5
|
||||||
|
Name: Camera
|
||||||
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [-4.12095118, 0.57130301, -1.16569459]
|
||||||
|
Rotation: [0, 106.199997, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
Camera:
|
||||||
|
Zoom: 10
|
||||||
|
FOV: 45
|
||||||
|
Orthographic: false
|
||||||
|
NearPlane: 0.100000001
|
||||||
|
FarPlane: 1000
|
62
assets/White_bookshelf.polys
Normal file
62
assets/White_bookshelf.polys
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
Entities:
|
||||||
|
- ID: 0
|
||||||
|
Name: Light
|
||||||
|
Components:
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 1
|
||||||
|
Color: [1, 1, 1]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0.0900000036
|
||||||
|
Quadratic: 0.0320000015
|
||||||
|
cutOff: 0
|
||||||
|
outerCutOff: 39.7900009
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
Transform:
|
||||||
|
Position: [-8.23400021, -0.379575908, 0.520573974]
|
||||||
|
Rotation: [1.5, 2.70000005, 342.5]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
- ID: 1
|
||||||
|
Name: Cube
|
||||||
|
Components:
|
||||||
|
Render:
|
||||||
|
MeshName: shelf
|
||||||
|
Color: [1, 1, 1]
|
||||||
|
Transform:
|
||||||
|
Position: [-1.21370173, 1.20000005, 0]
|
||||||
|
Rotation: [1.34287302e-05, -41.9440002, 1.62548586e-05]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
- ID: 2
|
||||||
|
Name: Light
|
||||||
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [0, -2.21429968, 4.51696587]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 1
|
||||||
|
Color: [1, 1, 1]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0.0900000036
|
||||||
|
Quadratic: 0.0320000015
|
||||||
|
cutOff: 12.5
|
||||||
|
outerCutOff: 17.5
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
- ID: 3
|
||||||
|
Name: Light
|
||||||
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [-4.97912979, 7.21913528, 4.91323614]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 1
|
||||||
|
Color: [1, 1, 1]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0.0900000036
|
||||||
|
Quadratic: 0.0320000015
|
||||||
|
cutOff: 12.5
|
||||||
|
outerCutOff: 17.5
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
BIN
assets/wood.png
Normal file
BIN
assets/wood.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 224 KiB |
BIN
build/Entity.o
BIN
build/Entity.o
Binary file not shown.
Binary file not shown.
BIN
build/main.o
BIN
build/main.o
Binary file not shown.
BIN
images/fileicon.png
Normal file
BIN
images/fileicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
BIN
images/objecticon.png
Normal file
BIN
images/objecticon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
BIN
images/sceneicon.png
Normal file
BIN
images/sceneicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
22
imgui.ini
22
imgui.ini
@ -16,13 +16,13 @@ DockId=0x00000005,0
|
|||||||
|
|
||||||
[Window][Game View]
|
[Window][Game View]
|
||||||
Pos=312,28
|
Pos=312,28
|
||||||
Size=1213,779
|
Size=1213,680
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000009,0
|
DockId=0x00000009,0
|
||||||
|
|
||||||
[Window][Asset Panel]
|
[Window][Asset Panel]
|
||||||
Pos=8,607
|
Pos=8,519
|
||||||
Size=302,582
|
Size=302,670
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000008,0
|
DockId=0x00000008,0
|
||||||
|
|
||||||
@ -34,13 +34,13 @@ DockId=0x0000000B,0
|
|||||||
|
|
||||||
[Window][Scene]
|
[Window][Scene]
|
||||||
Pos=8,28
|
Pos=8,28
|
||||||
Size=302,577
|
Size=302,489
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000007,0
|
DockId=0x00000007,0
|
||||||
|
|
||||||
[Window][Info]
|
[Window][Info]
|
||||||
Pos=312,809
|
Pos=312,710
|
||||||
Size=1213,380
|
Size=1213,479
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000A,0
|
DockId=0x0000000A,0
|
||||||
|
|
||||||
@ -59,14 +59,14 @@ DockId=0x00000009,1
|
|||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0xC746EC7D Window=0x9DF47A72 Pos=8,28 Size=1904,1161 Split=X Selected=0x642CEEBB
|
DockSpace ID=0xC746EC7D Window=0x9DF47A72 Pos=8,28 Size=1904,1161 Split=X Selected=0x642CEEBB
|
||||||
DockNode ID=0x00000003 Parent=0xC746EC7D SizeRef=1517,1161 Split=X
|
DockNode ID=0x00000003 Parent=0xC746EC7D SizeRef=1517,1161 Split=X
|
||||||
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=302,1161 Split=Y Selected=0x9D571615
|
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=302,1161 Split=Y Selected=0xE192E354
|
||||||
DockNode ID=0x00000007 Parent=0x00000001 SizeRef=580,577 Selected=0xE192E354
|
DockNode ID=0x00000007 Parent=0x00000001 SizeRef=302,489 Selected=0xE192E354
|
||||||
DockNode ID=0x00000008 Parent=0x00000001 SizeRef=580,582 Selected=0x9D571615
|
DockNode ID=0x00000008 Parent=0x00000001 SizeRef=302,670 Selected=0x9D571615
|
||||||
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1213,1161 Split=X
|
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1213,1161 Split=X
|
||||||
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=197,1161 Selected=0x4E0EE8E4
|
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=197,1161 Selected=0x4E0EE8E4
|
||||||
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=1035,1161 Split=Y Selected=0x642CEEBB
|
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=1035,1161 Split=Y Selected=0x642CEEBB
|
||||||
DockNode ID=0x00000009 Parent=0x00000006 SizeRef=1266,779 CentralNode=1 Selected=0x642CEEBB
|
DockNode ID=0x00000009 Parent=0x00000006 SizeRef=1266,680 CentralNode=1 Selected=0x642CEEBB
|
||||||
DockNode ID=0x0000000A Parent=0x00000006 SizeRef=1266,380 Selected=0xE534E588
|
DockNode ID=0x0000000A Parent=0x00000006 SizeRef=1266,479 Selected=0xE534E588
|
||||||
DockNode ID=0x00000004 Parent=0xC746EC7D SizeRef=385,1161 Split=Y Selected=0xE7039252
|
DockNode ID=0x00000004 Parent=0xC746EC7D SizeRef=385,1161 Split=Y Selected=0xE7039252
|
||||||
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=385,779 Selected=0xE7039252
|
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=385,779 Selected=0xE7039252
|
||||||
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=385,380 Selected=0x54723243
|
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=385,380 Selected=0x54723243
|
||||||
|
50
scene.polys
50
scene.polys
@ -1,15 +1,59 @@
|
|||||||
Entities:
|
Entities:
|
||||||
- ID: 0
|
- ID: 0
|
||||||
Name: Entity 0
|
Name: Light
|
||||||
|
Components:
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 1
|
||||||
|
Color: [1, 0, 0]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0.0900000036
|
||||||
|
Quadratic: 0.0320000015
|
||||||
|
cutOff: 0
|
||||||
|
outerCutOff: 39.7900009
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
Transform:
|
||||||
|
Position: [-8.23400021, -0.379575908, 0.520573974]
|
||||||
|
Rotation: [1.5, 2.70000005, 342.5]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
- ID: 1
|
||||||
|
Name: Cube
|
||||||
|
Components:
|
||||||
|
Render:
|
||||||
|
MeshName: shelf
|
||||||
|
Color: [1, 1, 1]
|
||||||
|
Transform:
|
||||||
|
Position: [-1.21370173, 1.20000005, 0]
|
||||||
|
Rotation: [1.34287302e-05, -41.9440002, 1.62548586e-05]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
- ID: 2
|
||||||
|
Name: Light
|
||||||
Components:
|
Components:
|
||||||
Transform:
|
Transform:
|
||||||
Position: [0, 0, 0]
|
Position: [0, -2.21429968, 4.51696587]
|
||||||
Rotation: [0, 0, 0]
|
Rotation: [0, 0, 0]
|
||||||
Scale: [1, 1, 1]
|
Scale: [1, 1, 1]
|
||||||
Light:
|
Light:
|
||||||
Type: 0
|
Type: 0
|
||||||
Intensity: 1
|
Intensity: 1
|
||||||
Color: [1, 1, 1]
|
Color: [0.186046124, 0, 1]
|
||||||
|
Constant: 1
|
||||||
|
Linear: 0.0900000036
|
||||||
|
Quadratic: 0.0320000015
|
||||||
|
cutOff: 12.5
|
||||||
|
outerCutOff: 17.5
|
||||||
|
Direction: [-0.200000003, -1, -0.300000012]
|
||||||
|
- ID: 3
|
||||||
|
Name: Light
|
||||||
|
Components:
|
||||||
|
Transform:
|
||||||
|
Position: [-4.97912979, 7.21913528, 4.91323614]
|
||||||
|
Rotation: [0, 0, 0]
|
||||||
|
Scale: [1, 1, 1]
|
||||||
|
Light:
|
||||||
|
Type: 0
|
||||||
|
Intensity: 1
|
||||||
|
Color: [0, 1, 0]
|
||||||
Constant: 1
|
Constant: 1
|
||||||
Linear: 0.0900000036
|
Linear: 0.0900000036
|
||||||
Quadratic: 0.0320000015
|
Quadratic: 0.0320000015
|
||||||
|
@ -19,6 +19,19 @@ void Entity::AddComponent(const std::shared_ptr<Component>& component)
|
|||||||
components[component->GetName()] = component;
|
components[component->GetName()] = component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::shared_ptr<Component> Entity::GetComponentByName(const std::string& name) const
|
||||||
|
{
|
||||||
|
auto it = components.find(name);
|
||||||
|
if (it != components.end())
|
||||||
|
{
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return nullptr; // Component not found
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
YAML::Node Entity::Serialize()
|
YAML::Node Entity::Serialize()
|
||||||
{
|
{
|
||||||
YAML::Node node;
|
YAML::Node node;
|
||||||
|
@ -19,6 +19,8 @@ public:
|
|||||||
Entity(int id, const std::string& name);
|
Entity(int id, const std::string& name);
|
||||||
|
|
||||||
void AddComponent(const std::shared_ptr<Component>& component);
|
void AddComponent(const std::shared_ptr<Component>& component);
|
||||||
|
std::shared_ptr<Component> GetComponentByName(const std::string& name) const;
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::shared_ptr<T> GetComponent()
|
std::shared_ptr<T> GetComponent()
|
||||||
|
1591
src/main.cpp
1591
src/main.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user