diff --git a/.gitignore b/.gitignore index 503012e..c65061d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ bin/ int/ *.aps -*.res \ No newline at end of file +*.res +*.nfpack \ No newline at end of file diff --git a/Game/src/MainState.cpp b/Game/src/MainState.cpp index 7ad2759..ba64f2a 100644 --- a/Game/src/MainState.cpp +++ b/Game/src/MainState.cpp @@ -61,9 +61,6 @@ void MainState::update(float deltaTime) { camera->moveLeft(speed * deltaTime); } - //test.setPosition(nf::Vec3(std::sin(circle) * 10.0, 5.0, std::cos(circle) * 10.0)); - circle += 1.5f * deltaTime; - text.setText("FPS: " + std::to_string(app->getFPS())); if (button.isClicked() || app->isKeyPressed(NFI_R)) @@ -79,6 +76,12 @@ void MainState::update(float deltaTime) { sound2.stop(); } + if (app->isKeyPressed(NFI_K)) { + entities.push_back(new nf::Entity); + entities.back()->create(ap["2mats.obj"], nf::Entity::Type::DYNAMIC); + entities.back()->setPosition(camera->getPosition()); + } + if (app->isKeyPressed(NFI_ESCAPE)) app->quit(); } @@ -102,6 +105,5 @@ void MainState::render(nf::Renderer& renderer) { void MainState::onExit() { Log("MainState onExit!"); - circle = 0.0f; entities.clear(); } \ No newline at end of file diff --git a/Game/src/include/MainState.h b/Game/src/include/MainState.h index 878e78c..f03adfd 100644 --- a/Game/src/include/MainState.h +++ b/Game/src/include/MainState.h @@ -27,7 +27,5 @@ private: nf::Sound sound; nf::Sound sound2; - float circle; - std::vector entities; }; \ No newline at end of file diff --git a/NothinFancy/assets/base.nfpack b/NothinFancy/assets/base.nfpack deleted file mode 100644 index f526355..0000000 Binary files a/NothinFancy/assets/base.nfpack and /dev/null differ diff --git a/NothinFancy/src/NFObject/Entity.cpp b/NothinFancy/src/NFObject/Entity.cpp index 7aa7bc0..a87f529 100644 --- a/NothinFancy/src/NFObject/Entity.cpp +++ b/NothinFancy/src/NFObject/Entity.cpp @@ -10,7 +10,7 @@ namespace nf { Entity::Entity() : m_constructed(false), - m_createdAtLoad(false), + m_member(false), m_type(Type::STATIC), m_model(nullptr), m_position(0.0), @@ -18,9 +18,8 @@ namespace nf { m_scale(1.0), m_update(false) { - if (Application::getApp() && Application::getApp()->getCurrentState()) - if (Application::getApp()->getCurrentState()->isLoading()) - m_createdAtLoad = true; + if (!Application::getApp() || !Application::getApp()->getCurrentState()) + m_member = true; } void Entity::create(Asset* modelAsset, Type type) { @@ -46,11 +45,10 @@ namespace nf { if (type != Type::DETAIL) Application::getApp()->getPhysicsEngine()->addActor(this); - if (!Application::getApp()->getCurrentState()->isRunning()) - if (m_createdAtLoad) - Application::getApp()->getCurrentState()->m_entsToDelete.push_back(this); - else + if (m_member) Application::getApp()->getCurrentState()->m_nfObjects.push_back(this); + else + Application::getApp()->getCurrentState()->m_entsToDelete.push_back(this); } bool Entity::isConstructed() { diff --git a/NothinFancy/src/Renderer/Model.cpp b/NothinFancy/src/Renderer/Model.cpp index 72de4d3..9feb091 100644 --- a/NothinFancy/src/Renderer/Model.cpp +++ b/NothinFancy/src/Renderer/Model.cpp @@ -19,8 +19,6 @@ namespace nf { Error("Model exceedes 32 texture limit!"); std::string obj = model->data; size_t startMtlPos = obj.find("newmtl"); - if (startMtlPos == std::string::npos) - Error("No materials found in model!"); std::string mtl = obj.substr(startMtlPos); struct TempMaterial { std::vector outVB; diff --git a/NothinFancy/src/include/Entity.h b/NothinFancy/src/include/Entity.h index fb5c912..53f58b8 100644 --- a/NothinFancy/src/include/Entity.h +++ b/NothinFancy/src/include/Entity.h @@ -49,7 +49,7 @@ namespace nf { ~Entity(); private: bool m_constructed; - bool m_createdAtLoad; + bool m_member; Type m_type; Model* m_model;