diff --git a/Geome3Dash/Geome3Dash.vcxproj b/Geome3Dash/Geome3Dash.vcxproj index 4ffe1dc4..a3fda47c 100644 --- a/Geome3Dash/Geome3Dash.vcxproj +++ b/Geome3Dash/Geome3Dash.vcxproj @@ -36,8 +36,8 @@ - - + + @@ -68,7 +68,7 @@ - + @@ -126,8 +126,8 @@ - - + + @@ -140,7 +140,7 @@ - + @@ -183,7 +183,7 @@ false true Unicode - ClangCL + v143 diff --git a/Geome3Dash/Geome3Dash.vcxproj.filters b/Geome3Dash/Geome3Dash.vcxproj.filters index 44fc1e2a..1fe7477d 100644 --- a/Geome3Dash/Geome3Dash.vcxproj.filters +++ b/Geome3Dash/Geome3Dash.vcxproj.filters @@ -90,7 +90,7 @@ Source Files - + Source Files @@ -207,10 +207,10 @@ Source Files - + Source Files - + Source Files @@ -284,7 +284,7 @@ Header Files - + Header Files @@ -383,10 +383,10 @@ Header Files - + Header Files - + Header Files diff --git a/Geome3Dash/src/BlockModelStorage.cpp b/Geome3Dash/src/BlockModelStorage.cpp index d22ac9f5..ecbbbab0 100644 --- a/Geome3Dash/src/BlockModelStorage.cpp +++ b/Geome3Dash/src/BlockModelStorage.cpp @@ -106,7 +106,7 @@ namespace g3d if (auto blockModel = getModel(modelPath)) { blockModels[i] = blockModel; } } } - catch (const std::filesystem::filesystem_error& e) + catch (...) { } diff --git a/Geome3Dash/src/GameObjectModel.h b/Geome3Dash/src/GameObjectModel.h index ebd7bc9e..270df197 100644 --- a/Geome3Dash/src/GameObjectModel.h +++ b/Geome3Dash/src/GameObjectModel.h @@ -19,8 +19,8 @@ namespace g3d protected: float opacity = 1.0f; sus3d::Model* model; - std::vector transformers; GameObject* gameObject; + std::vector transformers; public: GameObject* getGameObject() { return this->gameObject; } sus3d::Model* getModel() { return this->model; } @@ -50,7 +50,7 @@ namespace g3d { // memory leak but idk how to fix yet // nvm I think the scene should own the pointer to transformers - for (auto& transformer : transformers) { /*delete transformer;*/ } + // for (auto& transformer : transformers) { /*delete transformer;*/ } } }; } \ No newline at end of file diff --git a/Geome3Dash/src/LevelDataManager.h b/Geome3Dash/src/LevelDataManager.h index 929a1914..d8ef224d 100644 --- a/Geome3Dash/src/LevelDataManager.h +++ b/Geome3Dash/src/LevelDataManager.h @@ -27,8 +27,9 @@ namespace g3d // NLOHMANN_DEFINE_TYPE_INTRUSIVE(CubicBezier, x0, y0, cx1, cy1, cx2, cy2, x1, y1); //}; - struct LevelData + class LevelData { + public: //CubicBezierLD bezierCurve; // Bezier values //double bezierMultiplier; // Path size //std::vector actions; // Camera actions diff --git a/Geome3Dash/src/PlayerObjectModel.h b/Geome3Dash/src/PlayerObjectModel.h index 49e207ac..e0db4167 100644 --- a/Geome3Dash/src/PlayerObjectModel.h +++ b/Geome3Dash/src/PlayerObjectModel.h @@ -3,6 +3,7 @@ #include "GameObjectModel.h" class GameObject; +class PlayerObject; namespace g3d { diff --git a/Geome3Dash/src/engine/sus3d/Mesh.cpp b/Geome3Dash/src/engine/sus3d/Mesh.cpp index 364b90af..3124811c 100644 --- a/Geome3Dash/src/engine/sus3d/Mesh.cpp +++ b/Geome3Dash/src/engine/sus3d/Mesh.cpp @@ -123,7 +123,7 @@ namespace sus3d shaderProgram->setVec3("Ks", isCustomKs ? customKs : Ks); shaderProgram->setFloat("shininess", 32); shaderProgram->setFloat("d", isCustomD ? customD : d); - glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, NULL); + glDrawElements(GL_TRIANGLES, static_cast(indices.size()), GL_UNSIGNED_INT, NULL); glBindVertexArray(0); glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); diff --git a/Geome3Dash/src/game/editor/G3DEditorPopup.cpp b/Geome3Dash/src/game/editor/G3DCameraEditorPopup.cpp similarity index 91% rename from Geome3Dash/src/game/editor/G3DEditorPopup.cpp rename to Geome3Dash/src/game/editor/G3DCameraEditorPopup.cpp index c1e3cb8b..cd103305 100644 --- a/Geome3Dash/src/game/editor/G3DEditorPopup.cpp +++ b/Geome3Dash/src/game/editor/G3DCameraEditorPopup.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include "game/editor/G3DEditorPopup.h" +#include "game/editor/G3DCameraEditorPopup.h" #include "game/component/G3DBaseNode.h" #include "helper/OpenGLStateHelper.h" @@ -33,7 +33,7 @@ namespace g3d // //spike->setScale(glm::vec3(0.75)); //} - void G3DEditorScene::drawModel() + void G3DCameraEditorScene::drawModel() { static std::chrono::steady_clock::time_point lastUpdate; auto now = std::chrono::steady_clock::now(); @@ -112,7 +112,7 @@ namespace g3d for (auto& block : blocks) { block.render(shaderProgram, camera, light); } } - void G3DEditorScene::draw() + void G3DCameraEditorScene::draw() { CCNode::draw(); @@ -128,12 +128,12 @@ namespace g3d OpenGLStateHelper::pushState(); } - G3DEditorScene::~G3DEditorScene() + G3DCameraEditorScene::~G3DCameraEditorScene() { } - bool G3DEditorScene::init(LevelEditorLayer* lel) + bool G3DCameraEditorScene::init(LevelEditorLayer* lel) { this->lel = lel; playerObj = PlayerObject::create(0, 0, lel, lel->m_objectLayer, false); @@ -179,13 +179,13 @@ namespace g3d return CCNode::init(); } - void G3DEditorPopup::onClose(CCObject* ob) + void G3DCameraEditorPopup::onClose(CCObject* ob) { setLevelData(lel, currentLevelData); geode::Popup::onClose(ob); } - void G3DEditorPopup::updateCamera() + void G3DCameraEditorPopup::updateCamera() { if (m_spikeScene) { @@ -202,13 +202,13 @@ namespace g3d } } - void G3DEditorPopup::updateState(G3DNumberSetting* invoker) + void G3DCameraEditorPopup::updateState(G3DNumberSetting* invoker) { updateCamera(); for (auto& sett : m_settings) { sett->updateState(nullptr); } } - bool G3DEditorPopup::setup(LevelEditorLayer* plel) + bool G3DCameraEditorPopup::setup(LevelEditorLayer* plel) { lel = plel; @@ -283,7 +283,7 @@ namespace g3d m_mainLayer->addChildAtPosition( scrollBar, geode::Anchor::Center, ccp(layerBG->getContentWidth() / 2 + 10, 0)); - m_spikeScene = G3DEditorScene::create(lel); + m_spikeScene = G3DCameraEditorScene::create(lel); this->m_mainLayer->addChild(m_spikeScene); layerBG->setPositionX(layerBG->getPositionX() + 90); @@ -301,10 +301,10 @@ namespace g3d return true; } - void G3DEditorPopup::scene(LevelEditorLayer* plel) + void G3DCameraEditorPopup::scene(LevelEditorLayer* plel) { const CCSize uiSize = CCDirector::sharedDirector()->getWinSize() - CCSize(60, 40); - G3DEditorPopup* instance = new G3DEditorPopup(); + G3DCameraEditorPopup* instance = new G3DCameraEditorPopup(); if (instance && instance->initAnchored(uiSize.width, uiSize.height, plel)) { instance->m_noElasticity = true; @@ -318,7 +318,7 @@ namespace g3d } } - void G3DEditorScene::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods) { + void G3DCameraEditorScene::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods) { if (button == GLFW_MOUSE_BUTTON_RIGHT) { if (action == GLFW_PRESS) { isRightClicking = true; @@ -330,7 +330,7 @@ namespace g3d } } - void G3DEditorScene::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) { + void G3DCameraEditorScene::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) { if (isRightClicking) { if (!isRightClickingGetPos) { lastMouseX = static_cast(x); @@ -358,7 +358,7 @@ namespace g3d currentLevelData.z = playerCameraOffset.z; currentLevelData.yaw = playerCameraYawOffset; currentLevelData.pitch = playerCameraPitchOffset; - if (auto layer = dynamic_cast(this->getParent()->getParent())) + if (auto layer = dynamic_cast(this->getParent()->getParent())) { layer->updateState(); } @@ -366,7 +366,7 @@ namespace g3d } } - void G3DEditorScene::scrollWheel(float y, float x) { + void G3DCameraEditorScene::scrollWheel(float y, float x) { if (isPressingControl) { // Adjust the camera zoom level using the scroll wheel float zoomSensitivity = -0.128f; @@ -376,13 +376,13 @@ namespace g3d currentLevelData.z = playerCameraOffset.z; currentLevelData.yaw = playerCameraYawOffset; currentLevelData.pitch = playerCameraPitchOffset; - if (auto layer = dynamic_cast(this->getParent()->getParent())) { + if (auto layer = dynamic_cast(this->getParent()->getParent())) { layer->updateState(); } } } - void G3DEditorScene::onKey(enumKeyCodes key, bool pressed, bool holding) { + void G3DCameraEditorScene::onKey(enumKeyCodes key, bool pressed, bool holding) { switch (key) { case KEY_Control: isPressingControl = pressed; diff --git a/Geome3Dash/src/game/editor/G3DEditorPopup.h b/Geome3Dash/src/game/editor/G3DCameraEditorPopup.h similarity index 92% rename from Geome3Dash/src/game/editor/G3DEditorPopup.h rename to Geome3Dash/src/game/editor/G3DCameraEditorPopup.h index f968fb9a..cba59076 100644 --- a/Geome3Dash/src/game/editor/G3DEditorPopup.h +++ b/Geome3Dash/src/game/editor/G3DCameraEditorPopup.h @@ -30,7 +30,7 @@ namespace g3d { - class G3DEditorScene + class G3DCameraEditorScene : public CCNode , public CustomKeyboardDelegate , public CustomMouseDelegate @@ -84,10 +84,10 @@ namespace g3d virtual void onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) override; virtual void scrollWheel(float y, float x) override; - ~G3DEditorScene(); + ~G3DCameraEditorScene(); static auto create(LevelEditorLayer* lel) { - auto node = new G3DEditorScene; + auto node = new G3DCameraEditorScene; if (node->init(lel)) { node->autorelease(); } @@ -98,7 +98,7 @@ namespace g3d } }; - class G3DEditorPopup : public geode::Popup + class G3DCameraEditorPopup : public geode::Popup { public: static void scene(LevelEditorLayer* plel); @@ -109,7 +109,7 @@ namespace g3d bool setup(LevelEditorLayer*) override; //void addLabel(const char* text, const CCPoint& position); - G3DEditorScene* m_spikeScene; + G3DCameraEditorScene* m_spikeScene; geode::ScrollLayer* m_list; geode::TextInput* m_searchInput; std::vector> m_settings; @@ -121,6 +121,6 @@ namespace g3d private: //static CCSize popupPadding; - G3DEditorPopup() { } + G3DCameraEditorPopup() { } }; } \ No newline at end of file diff --git a/Geome3Dash/src/game/editor/CameraKeyframeEditorLoader.cpp b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorLoader.cpp similarity index 72% rename from Geome3Dash/src/game/editor/CameraKeyframeEditorLoader.cpp rename to Geome3Dash/src/game/editor/G3DCameraKeyframeEditorLoader.cpp index a10b138e..e2fca647 100644 --- a/Geome3Dash/src/game/editor/CameraKeyframeEditorLoader.cpp +++ b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorLoader.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "CameraKeyframeEditorLoader.h" -#include "CameraKeyframeEditorPopup.h" +#include "G3DCameraKeyframeEditorLoader.h" +#include "G3DCameraKeyframeEditorPopup.h" #include "helper/spline/Curve.h" #include "helper/spline/Spline.h" @@ -18,13 +18,12 @@ namespace g3d { - bool CameraKeyframeEditorLoader::init(LevelEditorLayer* lel) { + bool G3DCameraKeyframeEditorLoader::setup(LevelEditorLayer* lel) + { if (!CCNode::init()) return false; this->lel = lel; - auto size = CCDirector::sharedDirector()->getWinSize(); - layer3d = G3DBaseNode::create(); layer3d->camera.setPosition(glm::vec3(0, 0, 15)); layer3d->light.setPosition(glm::vec3(0, 50, 1000)); @@ -45,7 +44,7 @@ namespace g3d return true; } - void CameraKeyframeEditorLoader::updateLevel() { + void G3DCameraKeyframeEditorLoader::updateLevel() { levelLength = 0; CCObject* obj; CCARRAY_FOREACH(lel->m_objects, obj) { @@ -56,21 +55,21 @@ namespace g3d lengthScaleFactor = spline.length(10000) / levelLength; } - void CameraKeyframeEditorLoader::show() { + void G3DCameraKeyframeEditorLoader::show() { updateLevel(); - popup = CameraKeyframeEditorPopup::create(this); + popup = G3DCameraKeyframeEditorPopup::create(this); popup->show(); } - void CameraKeyframeEditorLoader::hide() { + void G3DCameraKeyframeEditorLoader::hide() { if (popup) { popup->onClose(nullptr); } } - CameraKeyframeEditorLoader* CameraKeyframeEditorLoader::create(LevelEditorLayer* lel) { - auto ret = new CameraKeyframeEditorLoader(); - if (ret && ret->init(lel)) { + G3DCameraKeyframeEditorLoader* G3DCameraKeyframeEditorLoader::create(LevelEditorLayer* lel) { + auto ret = new G3DCameraKeyframeEditorLoader(); + if (ret && ret->setup(lel)) { ret->autorelease(); return ret; } diff --git a/Geome3Dash/src/game/editor/CameraKeyframeEditorLoader.h b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorLoader.h similarity index 67% rename from Geome3Dash/src/game/editor/CameraKeyframeEditorLoader.h rename to Geome3Dash/src/game/editor/G3DCameraKeyframeEditorLoader.h index 3d7994c1..befcdd5f 100644 --- a/Geome3Dash/src/game/editor/CameraKeyframeEditorLoader.h +++ b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorLoader.h @@ -14,9 +14,9 @@ namespace g3d class G3DBaseNode; class Spline; class CameraKeyframeBuffer; - class CameraKeyframeEditorPopup; + class G3DCameraKeyframeEditorPopup; - class CameraKeyframeEditorLoader : public CCNode + class G3DCameraKeyframeEditorLoader : public CCNode { G3DBaseNode* layer3d; sus3d::ShaderProgram* blockShaderProgram; @@ -31,10 +31,10 @@ namespace g3d sus3d::Model* cube; - bool init(LevelEditorLayer* lel); + bool setup(LevelEditorLayer* lel); - CameraKeyframeEditorPopup* popup; + G3DCameraKeyframeEditorPopup* popup; public: CameraKeyframeBuffer keyframeBuffer; @@ -43,7 +43,7 @@ namespace g3d void show(); void hide(); - static CameraKeyframeEditorLoader* create(LevelEditorLayer* lel); - friend class CameraKeyframeEditorPopup; + static G3DCameraKeyframeEditorLoader* create(LevelEditorLayer* lel); + friend class G3DCameraKeyframeEditorPopup; }; } \ No newline at end of file diff --git a/Geome3Dash/src/game/editor/CameraKeyframeEditorPopup.cpp b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorPopup.cpp similarity index 84% rename from Geome3Dash/src/game/editor/CameraKeyframeEditorPopup.cpp rename to Geome3Dash/src/game/editor/G3DCameraKeyframeEditorPopup.cpp index f8a000cd..49097b59 100644 --- a/Geome3Dash/src/game/editor/CameraKeyframeEditorPopup.cpp +++ b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorPopup.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "CameraKeyframeEditorPopup.h" -#include "CameraKeyframeEditorLoader.h" +#include "G3DCameraKeyframeEditorPopup.h" +#include "G3DCameraKeyframeEditorLoader.h" #include "helper/spline/Curve.h" #include "helper/spline/Spline.h" @@ -20,7 +20,7 @@ namespace g3d { static LevelData currentLevelData = LevelData::getDefault(); - void CameraKeyframeEditorPopup::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods) { + void G3DCameraKeyframeEditorPopup::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods) { if (!isEditing) return; if (button == GLFW_MOUSE_BUTTON_LEFT) { if (action == GLFW_PRESS) { @@ -33,7 +33,7 @@ namespace g3d } } - void CameraKeyframeEditorPopup::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) { + void G3DCameraKeyframeEditorPopup::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) { if (!isEditing) return; if (isRightClicking) { if (!isRightClickingGetPos) { @@ -73,13 +73,13 @@ namespace g3d } - void CameraKeyframeEditorPopup::scrollWheel(float y, float x) { + void G3DCameraKeyframeEditorPopup::scrollWheel(float y, float x) { if (!isEditing) return; float zoomSensitivity = -0.0328f; ckel->layer3d->camera.setPosition(ckel->layer3d->camera.getPosition() + ckel->layer3d->camera.getFront() * y * zoomSensitivity); } - void CameraKeyframeEditorPopup::onKey(enumKeyCodes key, bool pressed, bool holding) { + void G3DCameraKeyframeEditorPopup::onKey(enumKeyCodes key, bool pressed, bool holding) { switch (key) { case KEY_A: if (pressed) @@ -91,10 +91,12 @@ namespace g3d case KEY_Control: isPressingControl = pressed; break; + default: + break; } } - bool CameraKeyframeEditorPopup::setup(CameraKeyframeEditorLoader* ckel) { + bool G3DCameraKeyframeEditorPopup::setup(G3DCameraKeyframeEditorLoader* ckel) { currentLevelData = LevelData::getDefault(); try { @@ -152,35 +154,35 @@ namespace g3d this->m_buttonMenu->setPosition(size / 2); auto backBtnSprite = CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png"); - backBtnSprite->setScale(0.7); - auto backBtn = CCMenuItemSpriteExtra::create(backBtnSprite, this, menu_selector(CameraKeyframeEditorPopup::onClose)); + backBtnSprite->setScale(0.7f); + auto backBtn = CCMenuItemSpriteExtra::create(backBtnSprite, this, menu_selector(G3DCameraKeyframeEditorPopup::onClose)); backBtn->setPosition(20, size.height - 20); this->m_buttonMenu->addChild(backBtn); auto addCurveSprite = CCSprite::createWithSpriteFrameName("GJ_plainBtn_001.png"); - addCurveSprite->setScale(0.7); + addCurveSprite->setScale(0.7f); auto addCurveLabel = CCLabelBMFont::create("+", "bigFont.fnt", 80.f); - addCurveLabel->setScale(1.2); + addCurveLabel->setScale(1.2f); addCurveLabel->setPosition(addCurveSprite->getContentSize() / 2 - ccp(0, -4.f)); addCurveSprite->addChild(addCurveLabel); - auto addCurveBtn = CCMenuItemSpriteExtra::create(addCurveSprite, this, menu_selector(CameraKeyframeEditorPopup::onAdd)); + auto addCurveBtn = CCMenuItemSpriteExtra::create(addCurveSprite, this, menu_selector(G3DCameraKeyframeEditorPopup::onAdd)); addCurveBtn->setPosition(60, size.height - 20); this->m_buttonMenu->addChild(addCurveBtn); auto removeCurveSprite = CCSprite::createWithSpriteFrameName("GJ_plainBtn_001.png"); - removeCurveSprite->setScale(0.7); + removeCurveSprite->setScale(0.7f); auto removeCurveLabel = CCLabelBMFont::create("-", "bigFont.fnt", 80.f); - removeCurveLabel->setScale(1.2); + removeCurveLabel->setScale(1.2f); removeCurveLabel->setPosition(removeCurveSprite->getContentSize() / 2 - ccp(0, -4.f)); removeCurveSprite->addChild(removeCurveLabel); - auto removeCurveBtn = CCMenuItemSpriteExtra::create(removeCurveSprite, this, menu_selector(CameraKeyframeEditorPopup::onRemoveLast)); + auto removeCurveBtn = CCMenuItemSpriteExtra::create(removeCurveSprite, this, menu_selector(G3DCameraKeyframeEditorPopup::onRemoveLast)); removeCurveBtn->setPosition(100, size.height - 20); this->m_buttonMenu->addChild(removeCurveBtn); return true; } - void CameraKeyframeEditorPopup::onClose(CCObject* obj) { + void G3DCameraKeyframeEditorPopup::onClose(CCObject* obj) { if (ckel->keyframeBuffer.keyframes.empty()) { setStartingKeyframe( @@ -196,7 +198,7 @@ namespace g3d Popup::onClose(obj); } - void CameraKeyframeEditorPopup::onAdd(CCObject*) { + void G3DCameraKeyframeEditorPopup::onAdd(CCObject*) { if (isEditing) { auto deltaPos = ckel->layer3d->camera.getPosition() - splineCamTr->getPlayerOrientedCameraPosition(&player1); @@ -211,7 +213,7 @@ namespace g3d ckel->lel->m_editorUI->onPlaytest(nullptr); isEditing = !isEditing; } - void CameraKeyframeEditorPopup::onRemoveLast(CCObject*) { + void G3DCameraKeyframeEditorPopup::onRemoveLast(CCObject*) { ckel->keyframeBuffer.removeLastKeyframe(); if (ckel->keyframeBuffer.keyframes.empty()) { @@ -222,7 +224,7 @@ namespace g3d } } - void CameraKeyframeEditorPopup::draw() + void G3DCameraKeyframeEditorPopup::draw() { OpenGLStateHelper::saveState(); @@ -243,8 +245,8 @@ namespace g3d } - CameraKeyframeEditorPopup* CameraKeyframeEditorPopup::create(CameraKeyframeEditorLoader* ckel) { - auto ret = new CameraKeyframeEditorPopup(); + G3DCameraKeyframeEditorPopup* G3DCameraKeyframeEditorPopup::create(G3DCameraKeyframeEditorLoader* ckel) { + auto ret = new G3DCameraKeyframeEditorPopup(); auto size = CCDirector::sharedDirector()->getWinSize(); if (ret->initAnchored(size.width, size.height, ckel)) { ret->autorelease(); diff --git a/Geome3Dash/src/game/editor/CameraKeyframeEditorPopup.h b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorPopup.h similarity index 72% rename from Geome3Dash/src/game/editor/CameraKeyframeEditorPopup.h rename to Geome3Dash/src/game/editor/G3DCameraKeyframeEditorPopup.h index 22e57b34..d9a2a9e2 100644 --- a/Geome3Dash/src/game/editor/CameraKeyframeEditorPopup.h +++ b/Geome3Dash/src/game/editor/G3DCameraKeyframeEditorPopup.h @@ -20,16 +20,16 @@ namespace sus3d namespace g3d { - class CameraKeyframeEditorLoader; + class G3DCameraKeyframeEditorLoader; - class CameraKeyframeEditorPopup - : public geode::Popup + class G3DCameraKeyframeEditorPopup + : public geode::Popup , public CustomKeyboardDelegate , public CustomMouseDelegate , public CustomTouchDelegate { protected: - CameraKeyframeEditorLoader* ckel; + G3DCameraKeyframeEditorLoader* ckel; bool isEditing = false; @@ -39,12 +39,12 @@ namespace g3d float lastMouseX = 0.0; float lastMouseY = 0.0; - virtual void onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods); - virtual void onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y); - virtual void scrollWheel(float y, float x); - virtual void onKey(enumKeyCodes key, bool pressed, bool holding); + virtual void onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods) override; + virtual void onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) override; + virtual void scrollWheel(float y, float x) override; + virtual void onKey(enumKeyCodes key, bool pressed, bool holding) override; - bool setup(CameraKeyframeEditorLoader* cel) override; + bool setup(G3DCameraKeyframeEditorLoader* cel) override; void draw() override; @@ -60,8 +60,8 @@ namespace g3d std::vector blocks; public: - void onClose(CCObject* obj); + void onClose(CCObject* obj) override; - static CameraKeyframeEditorPopup* create(CameraKeyframeEditorLoader* ckel); + static G3DCameraKeyframeEditorPopup* create(G3DCameraKeyframeEditorLoader* ckel); }; } \ No newline at end of file diff --git a/Geome3Dash/src/game/editor/G3DCurveEditorLoader.cpp b/Geome3Dash/src/game/editor/G3DCurveEditorLoader.cpp index 4f265bf5..f949be80 100644 --- a/Geome3Dash/src/game/editor/G3DCurveEditorLoader.cpp +++ b/Geome3Dash/src/game/editor/G3DCurveEditorLoader.cpp @@ -30,7 +30,7 @@ namespace g3d lengthScaleFactor = spline.length(10000) / levelLength; } - bool G3DCurveEditorLoader::init(LevelEditorLayer* lel) { + bool G3DCurveEditorLoader::setup(LevelEditorLayer* lel) { if (!CCNode::init()) return false; this->lel = lel; @@ -77,7 +77,7 @@ namespace g3d G3DCurveEditorLoader* G3DCurveEditorLoader::create(LevelEditorLayer* lel) { auto ret = new G3DCurveEditorLoader(); - if (ret && ret->init(lel)) { + if (ret && ret->setup(lel)) { ret->autorelease(); return ret; } diff --git a/Geome3Dash/src/game/editor/G3DCurveEditorLoader.h b/Geome3Dash/src/game/editor/G3DCurveEditorLoader.h index ec42cad8..f60966f9 100644 --- a/Geome3Dash/src/game/editor/G3DCurveEditorLoader.h +++ b/Geome3Dash/src/game/editor/G3DCurveEditorLoader.h @@ -27,7 +27,7 @@ namespace g3d float levelLength = 0; float lengthScaleFactor; - virtual bool init(LevelEditorLayer* lel); + virtual bool setup(LevelEditorLayer* lel); void updateLevel(); diff --git a/Geome3Dash/src/game/editor/G3DCurveEditorPopup.cpp b/Geome3Dash/src/game/editor/G3DCurveEditorPopup.cpp index 5c2308c3..9b06447a 100644 --- a/Geome3Dash/src/game/editor/G3DCurveEditorPopup.cpp +++ b/Geome3Dash/src/game/editor/G3DCurveEditorPopup.cpp @@ -60,7 +60,7 @@ namespace g3d cel->layer3d->getObjectIDByMousePositionShader->use(); auto renderFunction = [&](int segmentIndex, glm::vec3 position) { - cel->pointModel->setScale(glm::vec3(0.07)); + cel->pointModel->setScale(glm::vec3(0.07f)); cel->pointModel->setPosition(position); glm::mat4 model = cel->pointModel->prepareModelMatrix(); cel->layer3d->getObjectIDByMousePositionShader->setMat4("model", model); @@ -152,6 +152,8 @@ namespace g3d case KEY_Shift: isPressingShift = pressed; break; + default: + break; } } @@ -208,15 +210,15 @@ namespace g3d this->m_buttonMenu->setPosition(size / 2); auto backBtnSprite = CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png"); - backBtnSprite->setScale(0.7); + backBtnSprite->setScale(0.7f); auto backBtn = CCMenuItemSpriteExtra::create(backBtnSprite, this, menu_selector(G3DCurveEditorPopup::onClose)); backBtn->setPosition(20, size.height - 20); this->m_buttonMenu->addChild(backBtn); auto addCurveSprite = CCSprite::createWithSpriteFrameName("GJ_plainBtn_001.png"); - addCurveSprite->setScale(0.7); + addCurveSprite->setScale(0.7f); auto addCurveLabel = CCLabelBMFont::create("+", "bigFont.fnt", 80.f); - addCurveLabel->setScale(1.2); + addCurveLabel->setScale(1.2f); addCurveLabel->setPosition(addCurveSprite->getContentSize() / 2 - ccp(0, -4.f)); addCurveSprite->addChild(addCurveLabel); auto addCurveBtn = CCMenuItemSpriteExtra::create(addCurveSprite, this, menu_selector(G3DCurveEditorPopup::onAddSegment)); @@ -224,9 +226,9 @@ namespace g3d this->m_buttonMenu->addChild(addCurveBtn); auto removeCurveSprite = CCSprite::createWithSpriteFrameName("GJ_plainBtn_001.png"); - removeCurveSprite->setScale(0.7); + removeCurveSprite->setScale(0.7f); auto removeCurveLabel = CCLabelBMFont::create("-", "bigFont.fnt", 80.f); - removeCurveLabel->setScale(1.2); + removeCurveLabel->setScale(1.2f); removeCurveLabel->setPosition(removeCurveSprite->getContentSize() / 2 - ccp(0, -4.f)); removeCurveSprite->addChild(removeCurveLabel); auto removeCurveBtn = CCMenuItemSpriteExtra::create(removeCurveSprite, this, menu_selector(G3DCurveEditorPopup::onRemoveSegment)); @@ -254,14 +256,14 @@ namespace g3d OpenGLStateHelper::saveState(); for (auto segment : cel->spline.segments) { cel->pointModel->meshes[0]->setCustomKa(glm::vec3(1, 0, 0)); - cel->pointModel->setScale(glm::vec3(0.07)); + cel->pointModel->setScale(glm::vec3(0.07f)); cel->pointModel->setPosition(segment.p1); cel->pointModel->render(shaderProgram, cel->layer3d->camera.getViewMat(), cel->layer3d->light.getPosition(), cel->layer3d->light.getColor(), cel->layer3d->camera.getPosition(), cel->layer3d->camera.getProjectionMat()); cel->pointModel->setPosition(segment.p2); cel->pointModel->render(shaderProgram, cel->layer3d->camera.getViewMat(), cel->layer3d->light.getPosition(), cel->layer3d->light.getColor(), cel->layer3d->camera.getPosition(), cel->layer3d->camera.getProjectionMat()); cel->pointModel->meshes[0]->setCustomKa(glm::vec3(0, 1, 0)); - cel->pointModel->setScale(glm::vec3(0.05)); + cel->pointModel->setScale(glm::vec3(0.05f)); cel->pointModel->setPosition(segment.m1); cel->pointModel->render(shaderProgram, cel->layer3d->camera.getViewMat(), cel->layer3d->light.getPosition(), cel->layer3d->light.getColor(), cel->layer3d->camera.getPosition(), cel->layer3d->camera.getProjectionMat()); cel->pointModel->setPosition(segment.m2); @@ -269,10 +271,10 @@ namespace g3d } - for (float i = 0; i < 3; i += 0.005) { + for (float i = 0; i < 3; i += 0.005f) { cel->pointModel->setPosition(cel->spline.get(i)); cel->pointModel->meshes[0]->setCustomKa(glm::vec3(0.5, 0.5, 0.5)); - cel->pointModel->setScale(glm::vec3(0.001)); + cel->pointModel->setScale(glm::vec3(0.001f)); cel->pointModel->render(shaderProgram, cel->layer3d->camera.getViewMat(), cel->layer3d->light.getPosition(), cel->layer3d->light.getColor(), cel->layer3d->camera.getPosition(), cel->layer3d->camera.getProjectionMat()); } diff --git a/Geome3Dash/src/game/editor/G3DCurveEditorPopup.h b/Geome3Dash/src/game/editor/G3DCurveEditorPopup.h index 84fee6ae..5752e196 100644 --- a/Geome3Dash/src/game/editor/G3DCurveEditorPopup.h +++ b/Geome3Dash/src/game/editor/G3DCurveEditorPopup.h @@ -41,10 +41,10 @@ namespace g3d SplineGameObjectTransformer* splineTr; std::vector blocks; - virtual void onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods); - virtual void onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y); - virtual void scrollWheel(float y, float x); - virtual void onKey(enumKeyCodes key, bool pressed, bool holding); + virtual void onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int mods) override; + virtual void onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) override; + virtual void scrollWheel(float y, float x) override; + virtual void onKey(enumKeyCodes key, bool pressed, bool holding) override; bool setup(G3DCurveEditorLoader* cel) override; @@ -53,7 +53,7 @@ namespace g3d void onAddSegment(CCObject*); void onRemoveSegment(CCObject*); - void onClose(CCObject* obj); + void onClose(CCObject* obj) override; public: static G3DCurveEditorPopup* create(G3DCurveEditorLoader* cel); }; diff --git a/Geome3Dash/src/game/planet/G3DPlanetLayer.cpp b/Geome3Dash/src/game/planet/G3DPlanetLayer.cpp index da5f4576..3a428bea 100644 --- a/Geome3Dash/src/game/planet/G3DPlanetLayer.cpp +++ b/Geome3Dash/src/game/planet/G3DPlanetLayer.cpp @@ -392,7 +392,7 @@ namespace g3d continue; } - const auto percentage = PlanetStateManager::getInstance()->getProgressByLevelID(i - 1)->normal; + const auto percentage = PlanetStateManager::getInstance()->getProgressByLevelID(static_cast(i) - 1)->normal; cloudModel->meshes[realMeshId]->setVisible(percentage == 100 ? 0 : 1); } @@ -562,7 +562,7 @@ namespace g3d shaderProgram->setVec3("Ks", isCustomKs ? customKs : Ks); shaderProgram->setFloat("shininess", 32); shaderProgram->setFloat("d", (isCustomD ? customD : d) * opacityModifier); - glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, NULL); + glDrawElements(GL_TRIANGLES, static_cast(indices.size()), GL_UNSIGNED_INT, NULL); glBindVertexArray(0); glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); diff --git a/Geome3Dash/src/helper/spline/Spline.cpp b/Geome3Dash/src/helper/spline/Spline.cpp index 5bd4836b..578ed4b8 100644 --- a/Geome3Dash/src/helper/spline/Spline.cpp +++ b/Geome3Dash/src/helper/spline/Spline.cpp @@ -23,14 +23,10 @@ namespace g3d lengthCounter += deltaLength; parameterList.push_back(ParameterData(t, value, lengthCounter)); } - - for (int i = parameterList.size() - 10; i < parameterList.size(); i++) { - auto data = parameterList[i]; - } } int Spline::getPointsCount() { - return segments.size() * 3 + 1; + return static_cast(segments.size()) * 3 + 1; } std::vector Spline::getAllPoints() { diff --git a/Geome3Dash/src/helper/spline/Spline.h b/Geome3Dash/src/helper/spline/Spline.h index 2fd127a0..8910366d 100644 --- a/Geome3Dash/src/helper/spline/Spline.h +++ b/Geome3Dash/src/helper/spline/Spline.h @@ -4,8 +4,9 @@ namespace g3d { - struct Spline + class Spline { + public: struct ParameterData { float t; diff --git a/Geome3Dash/src/hook/LevelEditorLayer.cpp b/Geome3Dash/src/hook/LevelEditorLayer.cpp index 3b4bd0c1..18ac0d28 100644 --- a/Geome3Dash/src/hook/LevelEditorLayer.cpp +++ b/Geome3Dash/src/hook/LevelEditorLayer.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "game/editor/G3DEditorPopup.h" +#include "game/editor/G3DCameraEditorPopup.h" #include "game/editor/G3DCurveEditorLoader.h" -#include "game/editor/CameraKeyframeEditorLoader.h" +#include "game/editor/G3DCameraKeyframeEditorLoader.h" #include "helper/spline/Spline.h" #include "helper/spline/Curve.h" @@ -11,7 +11,7 @@ namespace g3d { struct Fields { G3DCurveEditorLoader* curveEditorLayer = nullptr; - CameraKeyframeEditorLoader* keyframeEditorLayer = nullptr; + G3DCameraKeyframeEditorLoader* keyframeEditorLayer = nullptr; }; void onCameraKeyframesEditor(CCObject* obj) { @@ -50,7 +50,7 @@ namespace g3d void onEditorPopup(CCObject * sender) { - G3DEditorPopup::scene(this); + G3DCameraEditorPopup::scene(this); } void addG3DMenu( @@ -98,7 +98,7 @@ namespace g3d m_fields->curveEditorLayer = G3DCurveEditorLoader::create(this); this->addChild(m_fields->curveEditorLayer); - m_fields->keyframeEditorLayer = CameraKeyframeEditorLoader::create(this); + m_fields->keyframeEditorLayer = G3DCameraKeyframeEditorLoader::create(this); this->addChild(m_fields->keyframeEditorLayer); return true; diff --git a/Geome3Dash/src/transformer/AnimationGameObjectModelTransformer.cpp b/Geome3Dash/src/transformer/AnimationGameObjectModelTransformer.cpp index 816f8c16..b36f5ffa 100644 --- a/Geome3Dash/src/transformer/AnimationGameObjectModelTransformer.cpp +++ b/Geome3Dash/src/transformer/AnimationGameObjectModelTransformer.cpp @@ -7,9 +7,13 @@ namespace g3d { void AnimationGameObjectModelTransformer::transform(GameObjectModel* gom) { + // do animations switch (gom->getGameObject()->m_objectID) { - // do animations + case 142: + break; + default: + break; } } } \ No newline at end of file diff --git a/README.md b/README.md index c373d62b..22897a83 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Geome3Dash -![titlebar](screenshots/gp1.jpg) +![gp1](screenshots/gp1.jpg) **Geome3Dash** transforms the 2D Geometry Dash you know and love into an exciting, open-source 3D experience. Jump into a new dimension of gameplay, customize levels like never before, and explore the adventure of a lifetime. @@ -39,7 +39,6 @@ Have suggestions or need help? Connect with developers and fans on our [Discord ## Screenshots -![gp1](screenshots/gp1.jpg) ![gp2](screenshots/gp2.png) ![world1](screenshots/world1.png) ![world2](screenshots/world2.png) diff --git a/library/incl/Geode/loader/Log.hpp b/library/incl/Geode/loader/Log.hpp index 5142b4b3..5d9e5cbe 100644 --- a/library/incl/Geode/loader/Log.hpp +++ b/library/incl/Geode/loader/Log.hpp @@ -74,7 +74,7 @@ namespace geode { using log_clock = std::chrono::system_clock; GEODE_DLL std::string generateLogName(); - GEODE_DLL void vlogImpl(Severity, Mod*, fmt::string_view format, fmt::format_args args); + void vlogImpl(Severity, Mod*, fmt::string_view format, fmt::format_args args); template inline void logImpl(Severity severity, Mod* mod, impl::FmtStr str, Args&&... args) {