Added shelf model: todo: hot model importing

This commit is contained in:
OusmBlueNinja 2024-11-25 22:03:37 -06:00
parent 5357de69a7
commit d3837ec326
15 changed files with 28654 additions and 144 deletions

View File

View File

@ -1,28 +0,0 @@
Entities:
- ID: 0
Name: Light
Components:
Light:
Type: 2
Intensity: 9.30000019
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: [-1.70000005, -0.200000003, -0.100000001]
Rotation: [1.5, 2.70000005, -17.5]
Scale: [1, 1, 1]
- ID: 1
Name: Cube
Components:
Render:
MeshName: WhiteCube
Color: [1, 1, 1]
Transform:
Position: [-1.21370173, 1.20000005, 0]
Rotation: [1.34287302e-05, -41.9440002, 1.62548586e-05]
Scale: [1, 1, 1]

12
assets/bookshelf.mtl Normal file
View File

@ -0,0 +1,12 @@
# Blender 4.3.0 MTL File: 'bookshelf.blend'
# www.blender.org
newmtl Material
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2

14301
assets/bookshelf.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
Entities:
- ID: 0
Name: Entity 0
Components:
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]
Transform:
Position: [0, 0, 0]
Rotation: [0, 0, 0]
Scale: [1, 1, 1]

View File

@ -1,8 +0,0 @@
Entities:
- ID: 0
Name: Entity 0
Components:
Transform:
Position: [0, 0, 0]
Rotation: [0, 0, 0]
Scale: [1, 1, 1]

14301
bookshelf.obj Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -16,9 +16,9 @@ DockId=0x00000005,0
[Window][Game View]
Pos=312,28
Size=607,779
Size=1213,779
Collapsed=0
DockId=0x0000000D,0
DockId=0x00000009,0
[Window][Asset Panel]
Pos=8,607
@ -51,25 +51,23 @@ Collapsed=0
DockId=0x0000000C,0
[Window][Camera Preview]
Pos=921,28
Size=604,779
Pos=312,28
Size=1213,779
Collapsed=0
DockId=0x0000000E,0
DockId=0x00000009,1
[Docking][Data]
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=0x00000001 Parent=0x00000003 SizeRef=302,1161 Split=Y Selected=0x9D571615
DockNode ID=0x00000007 Parent=0x00000001 SizeRef=580,577 Selected=0xE192E354
DockNode ID=0x00000008 Parent=0x00000001 SizeRef=580,582 Selected=0x9D571615
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1213,1161 Split=X
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=197,1161 Selected=0x4E0EE8E4
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=1035,1161 Split=Y Selected=0x642CEEBB
DockNode ID=0x00000009 Parent=0x00000006 SizeRef=1266,779 Split=X Selected=0x642CEEBB
DockNode ID=0x0000000D Parent=0x00000009 SizeRef=607,779 CentralNode=1 Selected=0x642CEEBB
DockNode ID=0x0000000E Parent=0x00000009 SizeRef=604,779 Selected=0x111AC246
DockNode ID=0x0000000A Parent=0x00000006 SizeRef=1266,380 Selected=0xE534E588
DockNode ID=0x00000004 Parent=0xC746EC7D SizeRef=385,1161 Split=Y Selected=0xE7039252
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=385,779 Selected=0xE7039252
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=385,380 Selected=0x54723243
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=0x00000001 Parent=0x00000003 SizeRef=302,1161 Split=Y Selected=0x9D571615
DockNode ID=0x00000007 Parent=0x00000001 SizeRef=580,577 Selected=0xE192E354
DockNode ID=0x00000008 Parent=0x00000001 SizeRef=580,582 Selected=0x9D571615
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1213,1161 Split=X
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=197,1161 Selected=0x4E0EE8E4
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=0x0000000A Parent=0x00000006 SizeRef=1266,380 Selected=0xE534E588
DockNode ID=0x00000004 Parent=0xC746EC7D SizeRef=385,1161 Split=Y Selected=0xE7039252
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=385,779 Selected=0xE7039252
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=385,380 Selected=0x54723243

View File

@ -1,85 +1,18 @@
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
Name: Entity 0
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]
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: 5
Name: Camera
Components:
Transform:
Position: [0, 0, 0]
Rotation: [0, 26.2000008, 0]
Scale: [0.100000001, 0.100000001, -0.100000001]
Camera:
Zoom: 10
FOV: 45
Orthographic: false
NearPlane: 0.100000001
FarPlane: 1000
Direction: [-0.200000003, -1, -0.300000012]

View File

@ -111,6 +111,8 @@ bool GameRunning = false;
Model ImportedModel;
Model ImportedModel_shelf;
// Function prototypes
void RenderCube(glm::mat4 model, glm::mat4 view, glm::mat4 projection, glm::vec3 viewPos, glm::vec3 lightPos);
@ -495,6 +497,14 @@ int main()
}
ImportedModel.textureID = ImportedModel.loadTexture("./assets/texture.png");
if (!ImportedModel_shelf.loadFromOBJ("./bookshelf.obj"))
{
std::cerr << "Failed to load model!" << std::endl;
return -1;
}
//ImportedModel.textureID = ImportedModel.loadTexture("./assets/texture.png");
// Cube vertex data
// Cube vertex data (positions and normals)
@ -1798,6 +1808,10 @@ void ShowGameView(std::vector<std::shared_ptr<Entity>> &entities)
{
ImportedModel.render(transform, render, cubeShader);
}
else if (render->meshName == "shelf")
{
ImportedModel_shelf.render(transform, render, cubeShader);
}
else
{
// Draw cube

5
test/test.md Normal file
View File

@ -0,0 +1,5 @@
# Physics 3d Test
make a C++ physics test
[https://www.reactphysics3d.com/documentation/index.html](https://www.reactphysics3d.com/documentation/index.html)