ADD: Render Gameboard
This commit is contained in:
parent
a1c6ffa0b7
commit
5262143af8
62
assets/models/GameBoard.mtl
Normal file
62
assets/models/GameBoard.mtl
Normal file
@ -0,0 +1,62 @@
|
||||
# Blender 5.2.0 LTS MTL File: 'GameBoard.blend'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Background
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd gameboard:brackground.png
|
||||
|
||||
newmtl Blue
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd chess_blue.png
|
||||
|
||||
newmtl Green
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd chess_green.png
|
||||
|
||||
newmtl Material
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd track.jpg
|
||||
|
||||
newmtl Red
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd chess_red.png
|
||||
|
||||
newmtl Yellow
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd chess_yellow.png
|
||||
BIN
assets/models/chess_green.png
Normal file
BIN
assets/models/chess_green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 368 B |
BIN
assets/models/chess_red.png
Normal file
BIN
assets/models/chess_red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 366 B |
BIN
assets/models/chess_yellow.png
Normal file
BIN
assets/models/chess_yellow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 367 B |
BIN
assets/models/gameboard:brackground.png
Normal file
BIN
assets/models/gameboard:brackground.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 369 B |
BIN
assets/models/track.jpg
Normal file
BIN
assets/models/track.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 351 KiB |
@ -19,4 +19,5 @@ void engine::CameraController::update(const Keyboard &keyboard, Camera &camera,
|
||||
if (keyboard.isKeyDown(GLFW_KEY_S)) camera.moveRelative(glm::vec3(0.0f, 0.0f, -1.0f), 10.0f, deltaTime);
|
||||
if (keyboard.isKeyDown(GLFW_KEY_A)) camera.moveRelative(glm::vec3(-1.0f, 0.0f, 0.0f), 10.0f, deltaTime);
|
||||
if (keyboard.isKeyDown(GLFW_KEY_D)) camera.moveRelative(glm::vec3(1.0f, 0.0f, 0.0f), 10.0f, deltaTime);
|
||||
if (keyboard.isKeyDown(GLFW_KEY_SPACE)) camera.moveRelative(glm::vec3(0.0f, 1.0f, 0.0f), 10.0f, deltaTime);
|
||||
}
|
||||
|
||||
@ -28,15 +28,6 @@ void GameLayer::onDetachImpl() {
|
||||
|
||||
void GameLayer::onUpdate(float deltaTime) {
|
||||
Layer::onUpdate(deltaTime);
|
||||
|
||||
auto transformComponentPool = m_entityRegistry.getPool<TransformComponent>();
|
||||
for (const auto& [entity, transform] : transformComponentPool) {
|
||||
m_entityRegistry.removeComponent<TransformComponent>(entity);
|
||||
|
||||
const auto updatedTransform = TransformComponent({0,0,0}, {0, transform.m_rotation.y + 1,0}, {1,1,1});
|
||||
m_entityRegistry.addComponent<TransformComponent>(entity, updatedTransform);
|
||||
}
|
||||
|
||||
m_cameraController->update(getKeyboard(), *m_camera, deltaTime);
|
||||
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include "ecs/standardComponents/TransformComponent.h"
|
||||
|
||||
GameScene::GameScene(engine::InputContextStack& inputStack, engine::Keyboard& keyboard, engine::Mouse& mouse) : Scene(inputStack, keyboard, mouse), m_camera(std::make_unique<engine::Camera>()) {
|
||||
m_pointLight = std::make_shared<engine::PointLight>(glm::vec3(.0f, .0f, -5.0f), glm::vec3(1.0f, 1.0f, 1.0f));
|
||||
m_pointLight = std::make_shared<engine::PointLight>(glm::vec3(.0f, 10.f, -5.0f), glm::vec3(1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
void GameScene::onEnter() {
|
||||
@ -21,15 +21,14 @@ void GameScene::onEnter() {
|
||||
m_camera->setPitch(0.0f);
|
||||
|
||||
if (assetManager->hasModel("pawn")) {
|
||||
engine::Entity entity = entityRegistry.createEntity();
|
||||
|
||||
const auto pawnModel = assetManager->getModel("pawn");
|
||||
const auto gameboardModel = assetManager->getModel("gameboard");
|
||||
const auto gameboardEntity = entityRegistry.createEntity();
|
||||
|
||||
const auto transform = engine::TransformComponent({0,0,0}, {0,0,0}, {1,1,1});
|
||||
const auto mesh = engine::MeshComponent(pawnModel);
|
||||
|
||||
entityRegistry.addComponent<engine::TransformComponent>(entity, transform);
|
||||
entityRegistry.addComponent<engine::MeshComponent>(entity, mesh);
|
||||
const auto mesh = engine::MeshComponent(gameboardModel);
|
||||
entityRegistry.addComponent<engine::TransformComponent>(gameboardEntity, transform);
|
||||
entityRegistry.addComponent<engine::MeshComponent>(gameboardEntity, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,5 +39,6 @@ void GameScene::onExit() {
|
||||
std::vector<engine::AssetRequest> GameScene::getRequiredAssets() const {
|
||||
std::vector<engine::AssetRequest> requests;
|
||||
requests.emplace_back(engine::ModelRequest{"pawn", "assets/models/chess.obj", engine::ModelSplitPolicy::Combined});
|
||||
requests.emplace_back(engine::ModelRequest{ "gameboard", "assets/models/GameBoard.obj", engine::ModelSplitPolicy::Combined});
|
||||
return requests;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user