diff --git a/include/components/collider.hpp b/include/components/collider.hpp index 766da99..35ec843 100644 --- a/include/components/collider.hpp +++ b/include/components/collider.hpp @@ -1,25 +1,28 @@ -#pragma once +#ifndef ENGINE_INCLUDE_COMPONENTS_COLLIDER_H_ +#define ENGINE_INCLUDE_COMPONENTS_COLLIDER_H_ #include + #include namespace engine { - struct AABB { - glm::vec3 pos1; - glm::vec3 pos2; - }; +struct AABB { + glm::vec3 pos1; + glm::vec3 pos2; +}; - class PhysicsSystem; +class PhysicsSystem; - struct ColliderComponent { - friend PhysicsSystem; +struct ColliderComponent { + friend PhysicsSystem; - bool isStatic = true; - bool isTrigger = false; // entity receives an event on collision enter and exit - AABB aabb{}; // broad phase + bool is_static = true; + bool is_trigger = + false; // entity receives an event on collision enter and exit + AABB aabb{}; // broad phase +}; - private: - }; +} // namespace engine -} +#endif \ No newline at end of file diff --git a/include/components/renderable.hpp b/include/components/renderable.hpp index f1d44fc..d907bbd 100644 --- a/include/components/renderable.hpp +++ b/include/components/renderable.hpp @@ -1,18 +1,19 @@ -#pragma once +#ifndef ENGINE_INCLUDE_COMPONENTS_RENDERABLE_H_ +#define ENGINE_INCLUDE_COMPONENTS_RENDERABLE_H_ #include +#include "resources/material.hpp" +#include "resources/mesh.hpp" + namespace engine { - namespace resources { - class Mesh; - class Material; - } +struct RenderableComponent { + std::shared_ptr mesh; + std::shared_ptr material; + bool shown = true; +}; - struct RenderableComponent { - std::shared_ptr mesh; - std::shared_ptr material; - bool shown = true; - }; +} // namespace engine -} +#endif \ No newline at end of file diff --git a/include/components/transform.hpp b/include/components/transform.hpp index 5f8a595..f13e0ec 100644 --- a/include/components/transform.hpp +++ b/include/components/transform.hpp @@ -1,22 +1,25 @@ -#pragma once +#ifndef ENGINE_INCLUDE_COMPONENTS_TRANSFORM_H_ +#define ENGINE_INCLUDE_COMPONENTS_TRANSFORM_H_ -#include #include #include +#include #include namespace engine { - struct TransformComponent { - glm::vec3 position; - glm::quat rotation; - glm::vec3 scale; +struct TransformComponent { + glm::vec3 position; + glm::quat rotation; + glm::vec3 scale; - glm::mat4 worldMatrix; + glm::mat4 world_matrix; - std::string tag; - uint32_t parent; - }; + std::string tag; + uint32_t parent; +}; -} +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/components/ui_element.hpp b/include/components/ui_element.hpp index 14b8343..c0b118f 100644 --- a/include/components/ui_element.hpp +++ b/include/components/ui_element.hpp @@ -1,9 +1,12 @@ -#pragma once +#ifndef ENGINE_INCLUDE_COMPONENTS_UI_ELEMENT_H_ +#define ENGINE_INCLUDE_COMPONENTS_UI_ELEMENT_H_ namespace engine { - struct UIElementComponent { - int n; - }; +struct UIElementComponent { + int n; +}; -} +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/inputs/keyboard.hpp b/include/inputs/keyboard.hpp index 196e576..bc275b3 100644 --- a/include/inputs/keyboard.hpp +++ b/include/inputs/keyboard.hpp @@ -1,374 +1,379 @@ -#pragma once +#ifndef ENGINE_INCLUDE_INPUTS_KEYBOARD_H_ +#define ENGINE_INCLUDE_INPUTS_KEYBOARD_H_ // Keyboard scancodes, taken from SDL_scancode.h -namespace engine::inputs { +namespace engine { +namespace inputs { enum class Key : int { - K_UNKNOWN = 0, + K_UNKNOWN = 0, - /** - * \name Usage page 0x07 - * - * These values are from usage page 0x07 (USB keyboard page). - */ - /* @{ */ + /** + * \name Usage page 0x07 + * + * These values are from usage page 0x07 (USB keyboard page). + */ + /* @{ */ - K_A = 4, - K_B = 5, - K_C = 6, - K_D = 7, - K_E = 8, - K_F = 9, - K_G = 10, - K_H = 11, - K_I = 12, - K_J = 13, - K_K = 14, - K_L = 15, - K_M = 16, - K_N = 17, - K_O = 18, - K_P = 19, - K_Q = 20, - K_R = 21, - K_S = 22, - K_T = 23, - K_U = 24, - K_V = 25, - K_W = 26, - K_X = 27, - K_Y = 28, - K_Z = 29, + K_A = 4, + K_B = 5, + K_C = 6, + K_D = 7, + K_E = 8, + K_F = 9, + K_G = 10, + K_H = 11, + K_I = 12, + K_J = 13, + K_K = 14, + K_L = 15, + K_M = 16, + K_N = 17, + K_O = 18, + K_P = 19, + K_Q = 20, + K_R = 21, + K_S = 22, + K_T = 23, + K_U = 24, + K_V = 25, + K_W = 26, + K_X = 27, + K_Y = 28, + K_Z = 29, - K_1 = 30, - K_2 = 31, - K_3 = 32, - K_4 = 33, - K_5 = 34, - K_6 = 35, - K_7 = 36, - K_8 = 37, - K_9 = 38, - K_0 = 39, + K_1 = 30, + K_2 = 31, + K_3 = 32, + K_4 = 33, + K_5 = 34, + K_6 = 35, + K_7 = 36, + K_8 = 37, + K_9 = 38, + K_0 = 39, - K_RETURN = 40, - K_ESCAPE = 41, - K_BACKSPACE = 42, - K_TAB = 43, - K_SPACE = 44, + K_RETURN = 40, + K_ESCAPE = 41, + K_BACKSPACE = 42, + K_TAB = 43, + K_SPACE = 44, - K_MINUS = 45, - K_EQUALS = 46, - K_LEFTBRACKET = 47, - K_RIGHTBRACKET = 48, - K_BACKSLASH = 49, /**< Located at the lower left of the return - * key on ISO keyboards and at the right end - * of the QWERTY row on ANSI keyboards. - * Produces REVERSE SOLIDUS (backslash) and - * VERTICAL LINE in a US layout, REVERSE - * SOLIDUS and VERTICAL LINE in a UK Mac - * layout, NUMBER SIGN and TILDE in a UK - * Windows layout, DOLLAR SIGN and POUND SIGN - * in a Swiss German layout, NUMBER SIGN and - * APOSTROPHE in a German layout, GRAVE - * ACCENT and POUND SIGN in a French Mac - * layout, and ASTERISK and MICRO SIGN in a - * French Windows layout. - */ - K_NONUSHASH = 50, /**< ISO USB keyboards actually use this code - * instead of 49 for the same key, but all - * OSes I've seen treat the two codes - * identically. So, as an implementor, unless - * your keyboard generates both of those - * codes and your OS treats them differently, - * you should generate BACKSLASH - * instead of this code. As a user, you - * should not rely on this code because SDL - * will never generate it with most (all?) - * keyboards. - */ - K_SEMICOLON = 51, - K_APOSTROPHE = 52, - K_GRAVE = 53, /**< Located in the top left corner (on both ANSI - * and ISO keyboards). Produces GRAVE ACCENT and - * TILDE in a US Windows layout and in US and UK - * Mac layouts on ANSI keyboards, GRAVE ACCENT - * and NOT SIGN in a UK Windows layout, SECTION - * SIGN and PLUS-MINUS SIGN in US and UK Mac - * layouts on ISO keyboards, SECTION SIGN and - * DEGREE SIGN in a Swiss German layout (Mac: - * only on ISO keyboards), CIRCUMFLEX ACCENT and - * DEGREE SIGN in a German layout (Mac: only on - * ISO keyboards), SUPERSCRIPT TWO and TILDE in a - * French Windows layout, COMMERCIAL AT and - * NUMBER SIGN in a French Mac layout on ISO - * keyboards, and LESS-THAN SIGN and GREATER-THAN - * SIGN in a Swiss German, German, or French Mac - * layout on ANSI keyboards. - */ - K_COMMA = 54, - K_PERIOD = 55, - K_SLASH = 56, + K_MINUS = 45, + K_EQUALS = 46, + K_LEFTBRACKET = 47, + K_RIGHTBRACKET = 48, + K_BACKSLASH = 49, /**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout, REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout, NUMBER SIGN and TILDE in a UK + * Windows layout, DOLLAR SIGN and POUND SIGN + * in a Swiss German layout, NUMBER SIGN and + * APOSTROPHE in a German layout, GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout, and ASTERISK and MICRO SIGN in a + * French Windows layout. + */ + K_NONUSHASH = 50, /**< ISO USB keyboards actually use this code + * instead of 49 for the same key, but all + * OSes I've seen treat the two codes + * identically. So, as an implementor, unless + * your keyboard generates both of those + * codes and your OS treats them differently, + * you should generate BACKSLASH + * instead of this code. As a user, you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. + */ + K_SEMICOLON = 51, + K_APOSTROPHE = 52, + K_GRAVE = 53, /**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards, GRAVE ACCENT + * and NOT SIGN in a UK Windows layout, SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards, SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards), CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on + * ISO keyboards), SUPERSCRIPT TWO and TILDE in a + * French Windows layout, COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO + * keyboards, and LESS-THAN SIGN and GREATER-THAN + * SIGN in a Swiss German, German, or French Mac + * layout on ANSI keyboards. + */ + K_COMMA = 54, + K_PERIOD = 55, + K_SLASH = 56, - K_CAPSLOCK = 57, + K_CAPSLOCK = 57, - K_F1 = 58, - K_F2 = 59, - K_F3 = 60, - K_F4 = 61, - K_F5 = 62, - K_F6 = 63, - K_F7 = 64, - K_F8 = 65, - K_F9 = 66, - K_F10 = 67, - K_F11 = 68, - K_F12 = 69, + K_F1 = 58, + K_F2 = 59, + K_F3 = 60, + K_F4 = 61, + K_F5 = 62, + K_F6 = 63, + K_F7 = 64, + K_F8 = 65, + K_F9 = 66, + K_F10 = 67, + K_F11 = 68, + K_F12 = 69, - K_PRINTSCREEN = 70, - K_SCROLLLOCK = 71, - K_PAUSE = 72, - K_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but - does send code 73, not 117) */ - K_HOME = 74, - K_PAGEUP = 75, - K_DELETE = 76, - K_END = 77, - K_PAGEDOWN = 78, - K_RIGHT = 79, - K_LEFT = 80, - K_DOWN = 81, - K_UP = 82, + K_PRINTSCREEN = 70, + K_SCROLLLOCK = 71, + K_PAUSE = 72, + K_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but + does send code 73, not 117) */ + K_HOME = 74, + K_PAGEUP = 75, + K_DELETE = 76, + K_END = 77, + K_PAGEDOWN = 78, + K_RIGHT = 79, + K_LEFT = 80, + K_DOWN = 81, + K_UP = 82, - K_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards - */ - K_KP_DIVIDE = 84, - K_KP_MULTIPLY = 85, - K_KP_MINUS = 86, - K_KP_PLUS = 87, - K_KP_ENTER = 88, - K_KP_1 = 89, - K_KP_2 = 90, - K_KP_3 = 91, - K_KP_4 = 92, - K_KP_5 = 93, - K_KP_6 = 94, - K_KP_7 = 95, - K_KP_8 = 96, - K_KP_9 = 97, - K_KP_0 = 98, - K_KP_PERIOD = 99, + K_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards + */ + K_KP_DIVIDE = 84, + K_KP_MULTIPLY = 85, + K_KP_MINUS = 86, + K_KP_PLUS = 87, + K_KP_ENTER = 88, + K_KP_1 = 89, + K_KP_2 = 90, + K_KP_3 = 91, + K_KP_4 = 92, + K_KP_5 = 93, + K_KP_6 = 94, + K_KP_7 = 95, + K_KP_8 = 96, + K_KP_9 = 97, + K_KP_0 = 98, + K_KP_PERIOD = 99, - K_NONUSBACKSLASH = 100, /**< This is the additional key that ISO - * keyboards have over ANSI ones, - * located between left shift and Y. - * Produces GRAVE ACCENT and TILDE in a - * US or UK Mac layout, REVERSE SOLIDUS - * (backslash) and VERTICAL LINE in a - * US or UK Windows layout, and - * LESS-THAN SIGN and GREATER-THAN SIGN - * in a Swiss German, German, or French - * layout. */ - K_APPLICATION = 101, /**< windows contextual menu, compose */ - K_POWER = 102, /**< The USB document says this is a status flag, - * not a physical key - but some Mac keyboards - * do have a power key. */ - K_KP_EQUALS = 103, - K_F13 = 104, - K_F14 = 105, - K_F15 = 106, - K_F16 = 107, - K_F17 = 108, - K_F18 = 109, - K_F19 = 110, - K_F20 = 111, - K_F21 = 112, - K_F22 = 113, - K_F23 = 114, - K_F24 = 115, - K_EXECUTE = 116, - K_HELP = 117, - K_MENU = 118, - K_SELECT = 119, - K_STOP = 120, - K_AGAIN = 121, /**< redo */ - K_UNDO = 122, - K_CUT = 123, - K_COPY = 124, - K_PASTE = 125, - K_FIND = 126, - K_MUTE = 127, - K_VOLUMEUP = 128, - K_VOLUMEDOWN = 129, -/* not sure whether there's a reason to enable these */ -/* LOCKINGCAPSLOCK = 130, */ -/* LOCKINGNUMLOCK = 131, */ -/* LOCKINGSCROLLLOCK = 132, */ - K_KP_COMMA = 133, - K_KP_EQUALSAS400 = 134, + K_NONUSBACKSLASH = 100, /**< This is the additional key that ISO + * keyboards have over ANSI ones, + * located between left shift and Y. + * Produces GRAVE ACCENT and TILDE in a + * US or UK Mac layout, REVERSE SOLIDUS + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout, and + * LESS-THAN SIGN and GREATER-THAN SIGN + * in a Swiss German, German, or French + * layout. */ + K_APPLICATION = 101, /**< windows contextual menu, compose */ + K_POWER = 102, /**< The USB document says this is a status flag, + * not a physical key - but some Mac keyboards + * do have a power key. */ + K_KP_EQUALS = 103, + K_F13 = 104, + K_F14 = 105, + K_F15 = 106, + K_F16 = 107, + K_F17 = 108, + K_F18 = 109, + K_F19 = 110, + K_F20 = 111, + K_F21 = 112, + K_F22 = 113, + K_F23 = 114, + K_F24 = 115, + K_EXECUTE = 116, + K_HELP = 117, + K_MENU = 118, + K_SELECT = 119, + K_STOP = 120, + K_AGAIN = 121, /**< redo */ + K_UNDO = 122, + K_CUT = 123, + K_COPY = 124, + K_PASTE = 125, + K_FIND = 126, + K_MUTE = 127, + K_VOLUMEUP = 128, + K_VOLUMEDOWN = 129, + /* not sure whether there's a reason to enable these */ + /* LOCKINGCAPSLOCK = 130, */ + /* LOCKINGNUMLOCK = 131, */ + /* LOCKINGSCROLLLOCK = 132, */ + K_KP_COMMA = 133, + K_KP_EQUALSAS400 = 134, - K_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see - footnotes in USB doc */ - K_INTERNATIONAL2 = 136, - K_INTERNATIONAL3 = 137, /**< Yen */ - K_INTERNATIONAL4 = 138, - K_INTERNATIONAL5 = 139, - K_INTERNATIONAL6 = 140, - K_INTERNATIONAL7 = 141, - K_INTERNATIONAL8 = 142, - K_INTERNATIONAL9 = 143, - K_LANG1 = 144, /**< Hangul/English toggle */ - K_LANG2 = 145, /**< Hanja conversion */ - K_LANG3 = 146, /**< Katakana */ - K_LANG4 = 147, /**< Hiragana */ - K_LANG5 = 148, /**< Zenkaku/Hankaku */ - K_LANG6 = 149, /**< reserved */ - K_LANG7 = 150, /**< reserved */ - K_LANG8 = 151, /**< reserved */ - K_LANG9 = 152, /**< reserved */ + K_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see + footnotes in USB doc */ + K_INTERNATIONAL2 = 136, + K_INTERNATIONAL3 = 137, /**< Yen */ + K_INTERNATIONAL4 = 138, + K_INTERNATIONAL5 = 139, + K_INTERNATIONAL6 = 140, + K_INTERNATIONAL7 = 141, + K_INTERNATIONAL8 = 142, + K_INTERNATIONAL9 = 143, + K_LANG1 = 144, /**< Hangul/English toggle */ + K_LANG2 = 145, /**< Hanja conversion */ + K_LANG3 = 146, /**< Katakana */ + K_LANG4 = 147, /**< Hiragana */ + K_LANG5 = 148, /**< Zenkaku/Hankaku */ + K_LANG6 = 149, /**< reserved */ + K_LANG7 = 150, /**< reserved */ + K_LANG8 = 151, /**< reserved */ + K_LANG9 = 152, /**< reserved */ - K_ALTERASE = 153, /**< Erase-Eaze */ - K_SYSREQ = 154, - K_CANCEL = 155, - K_CLEAR = 156, - K_PRIOR = 157, - K_RETURN2 = 158, - K_SEPARATOR = 159, - K_OUT = 160, - K_OPER = 161, - K_CLEARAGAIN = 162, - K_CRSEL = 163, - K_EXSEL = 164, + K_ALTERASE = 153, /**< Erase-Eaze */ + K_SYSREQ = 154, + K_CANCEL = 155, + K_CLEAR = 156, + K_PRIOR = 157, + K_RETURN2 = 158, + K_SEPARATOR = 159, + K_OUT = 160, + K_OPER = 161, + K_CLEARAGAIN = 162, + K_CRSEL = 163, + K_EXSEL = 164, - K_KP_00 = 176, - K_KP_000 = 177, - K_THOUSANDSSEPARATOR = 178, - K_DECIMALSEPARATOR = 179, - K_CURRENCYUNIT = 180, - K_CURRENCYSUBUNIT = 181, - K_KP_LEFTPAREN = 182, - K_KP_RIGHTPAREN = 183, - K_KP_LEFTBRACE = 184, - K_KP_RIGHTBRACE = 185, - K_KP_TAB = 186, - K_KP_BACKSPACE = 187, - K_KP_A = 188, - K_KP_B = 189, - K_KP_C = 190, - K_KP_D = 191, - K_KP_E = 192, - K_KP_F = 193, - K_KP_XOR = 194, - K_KP_POWER = 195, - K_KP_PERCENT = 196, - K_KP_LESS = 197, - K_KP_GREATER = 198, - K_KP_AMPERSAND = 199, - K_KP_DBLAMPERSAND = 200, - K_KP_VERTICALBAR = 201, - K_KP_DBLVERTICALBAR = 202, - K_KP_COLON = 203, - K_KP_HASH = 204, - K_KP_SPACE = 205, - K_KP_AT = 206, - K_KP_EXCLAM = 207, - K_KP_MEMSTORE = 208, - K_KP_MEMRECALL = 209, - K_KP_MEMCLEAR = 210, - K_KP_MEMADD = 211, - K_KP_MEMSUBTRACT = 212, - K_KP_MEMMULTIPLY = 213, - K_KP_MEMDIVIDE = 214, - K_KP_PLUSMINUS = 215, - K_KP_CLEAR = 216, - K_KP_CLEARENTRY = 217, - K_KP_BINARY = 218, - K_KP_OCTAL = 219, - K_KP_DECIMAL = 220, - K_KP_HEXADECIMAL = 221, + K_KP_00 = 176, + K_KP_000 = 177, + K_THOUSANDSSEPARATOR = 178, + K_DECIMALSEPARATOR = 179, + K_CURRENCYUNIT = 180, + K_CURRENCYSUBUNIT = 181, + K_KP_LEFTPAREN = 182, + K_KP_RIGHTPAREN = 183, + K_KP_LEFTBRACE = 184, + K_KP_RIGHTBRACE = 185, + K_KP_TAB = 186, + K_KP_BACKSPACE = 187, + K_KP_A = 188, + K_KP_B = 189, + K_KP_C = 190, + K_KP_D = 191, + K_KP_E = 192, + K_KP_F = 193, + K_KP_XOR = 194, + K_KP_POWER = 195, + K_KP_PERCENT = 196, + K_KP_LESS = 197, + K_KP_GREATER = 198, + K_KP_AMPERSAND = 199, + K_KP_DBLAMPERSAND = 200, + K_KP_VERTICALBAR = 201, + K_KP_DBLVERTICALBAR = 202, + K_KP_COLON = 203, + K_KP_HASH = 204, + K_KP_SPACE = 205, + K_KP_AT = 206, + K_KP_EXCLAM = 207, + K_KP_MEMSTORE = 208, + K_KP_MEMRECALL = 209, + K_KP_MEMCLEAR = 210, + K_KP_MEMADD = 211, + K_KP_MEMSUBTRACT = 212, + K_KP_MEMMULTIPLY = 213, + K_KP_MEMDIVIDE = 214, + K_KP_PLUSMINUS = 215, + K_KP_CLEAR = 216, + K_KP_CLEARENTRY = 217, + K_KP_BINARY = 218, + K_KP_OCTAL = 219, + K_KP_DECIMAL = 220, + K_KP_HEXADECIMAL = 221, - K_LCTRL = 224, - K_LSHIFT = 225, - K_LALT = 226, /**< alt, option */ - K_LGUI = 227, /**< windows, command (apple), meta */ - K_RCTRL = 228, - K_RSHIFT = 229, - K_RALT = 230, /**< alt gr, option */ - K_RGUI = 231, /**< windows, command (apple), meta */ + K_LCTRL = 224, + K_LSHIFT = 225, + K_LALT = 226, /**< alt, option */ + K_LGUI = 227, /**< windows, command (apple), meta */ + K_RCTRL = 228, + K_RSHIFT = 229, + K_RALT = 230, /**< alt gr, option */ + K_RGUI = 231, /**< windows, command (apple), meta */ - K_MODE = 257, /**< I'm not sure if this is really not covered - * by any of the above, but since there's a - * special KMOD_MODE for it I'm adding it here - */ + K_MODE = 257, /**< I'm not sure if this is really not covered + * by any of the above, but since there's a + * special KMOD_MODE for it I'm adding it here + */ - /* @} *//* Usage page 0x07 */ + /* @} */ /* Usage page 0x07 */ - /** - * \name Usage page 0x0C - * - * These values are mapped from usage page 0x0C (USB consumer page). - */ - /* @{ */ + /** + * \name Usage page 0x0C + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ - K_AUDIONEXT = 258, - K_AUDIOPREV = 259, - K_AUDIOSTOP = 260, - K_AUDIOPLAY = 261, - K_AUDIOMUTE = 262, - K_MEDIASELECT = 263, - K_WWW = 264, - K_MAIL = 265, - K_CALCULATOR = 266, - K_COMPUTER = 267, - K_AC_SEARCH = 268, - K_AC_HOME = 269, - K_AC_BACK = 270, - K_AC_FORWARD = 271, - K_AC_STOP = 272, - K_AC_REFRESH = 273, - K_AC_BOOKMARKS = 274, + K_AUDIONEXT = 258, + K_AUDIOPREV = 259, + K_AUDIOSTOP = 260, + K_AUDIOPLAY = 261, + K_AUDIOMUTE = 262, + K_MEDIASELECT = 263, + K_WWW = 264, + K_MAIL = 265, + K_CALCULATOR = 266, + K_COMPUTER = 267, + K_AC_SEARCH = 268, + K_AC_HOME = 269, + K_AC_BACK = 270, + K_AC_FORWARD = 271, + K_AC_STOP = 272, + K_AC_REFRESH = 273, + K_AC_BOOKMARKS = 274, - /* @} *//* Usage page 0x0C */ + /* @} */ /* Usage page 0x0C */ - /** - * \name Walther keys - * - * These are values that Christian Walther added (for mac keyboard?). - */ - /* @{ */ + /** + * \name Walther keys + * + * These are values that Christian Walther added (for mac keyboard?). + */ + /* @{ */ - K_BRIGHTNESSDOWN = 275, - K_BRIGHTNESSUP = 276, - K_DISPLAYSWITCH = 277, /**< display mirroring/dual display - switch, video mode switch */ - K_KBDILLUMTOGGLE = 278, - K_KBDILLUMDOWN = 279, - K_KBDILLUMUP = 280, - K_EJECT = 281, - K_SLEEP = 282, + K_BRIGHTNESSDOWN = 275, + K_BRIGHTNESSUP = 276, + K_DISPLAYSWITCH = 277, /**< display mirroring/dual display + switch, video mode switch */ + K_KBDILLUMTOGGLE = 278, + K_KBDILLUMDOWN = 279, + K_KBDILLUMUP = 280, + K_EJECT = 281, + K_SLEEP = 282, - K_APP1 = 283, - K_APP2 = 284, + K_APP1 = 283, + K_APP2 = 284, - /* @} *//* Walther keys */ + /* @} */ /* Walther keys */ - /** - * \name Usage page 0x0C (additional media keys) - * - * These values are mapped from usage page 0x0C (USB consumer page). - */ - /* @{ */ + /** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ - K_AUDIOREWIND = 285, - K_AUDIOFASTFORWARD = 286, + K_AUDIOREWIND = 285, + K_AUDIOFASTFORWARD = 286, - /* @} *//* Usage page 0x0C (additional media keys) */ + /* @} */ /* Usage page 0x0C (additional media keys) */ - /* Add any other keys here. */ + /* Add any other keys here. */ - NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes - for array bounds */ + NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes + for array bounds */ }; -} +} // namespace inputs +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/inputs/mouse.hpp b/include/inputs/mouse.hpp index 712455c..ccc20e8 100644 --- a/include/inputs/mouse.hpp +++ b/include/inputs/mouse.hpp @@ -1,22 +1,22 @@ -#pragma once +#ifndef ENGINE_INCLUDE_INPUTS_MOUSE_H_ +#define ENGINE_INCLUDE_INPUTS_MOUSE_H_ -namespace engine::inputs { +namespace engine { +namespace inputs { enum class MouseButton : int { - M_LEFT, - M_MIDDLE, - M_RIGHT, - M_X1, - M_X2, - M_INVALID=7, - M_SIZE=7 + M_LEFT, + M_MIDDLE, + M_RIGHT, + M_X1, + M_X2, + M_INVALID = 7, + M_SIZE = 7 }; -enum class MouseAxis : int { - X, - Y, - X_SCR, - Y_SCR -}; +enum class MouseAxis : int { X, Y, X_SCR, Y_SCR }; -} +} // namespace inputs +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/logger.hpp b/include/logger.hpp index 3b5dc0e..250aa8a 100644 --- a/include/logger.hpp +++ b/include/logger.hpp @@ -4,11 +4,11 @@ #include #include +#include "log.hpp" + #include #include -#include "log.hpp" - namespace engine { // To be executed in the target application, NOT engine.dll diff --git a/include/resources/material.hpp b/include/resources/material.hpp index 5959faa..13c34ad 100644 --- a/include/resources/material.hpp +++ b/include/resources/material.hpp @@ -1,28 +1,31 @@ -#pragma once +#ifndef ENGINE_INCLUDE_RESOURCES_MATERIAL_H_ +#define ENGINE_INCLUDE_RESOURCES_MATERIAL_H_ #include -namespace engine::resources { +#include "resources/shader.hpp" +#include "resources/texture.hpp" - class Shader; - class Texture; +namespace engine { +namespace resources { - // copyable - class Material { +// copyable +class Material { + public: + Material(std::shared_ptr shader); + ~Material() = default; + Material(const Material&); + Material& operator=(const Material&) = delete; - public: - Material(std::shared_ptr shader); - ~Material() = default; - Material(const Material&); - Material& operator=(const Material&) = delete; + auto GetShader() { return shader_.get(); } - auto getShader() { return m_shader.get(); } + std::shared_ptr texture_; - std::shared_ptr m_texture; + private: + const std::shared_ptr shader_; +}; - private: - const std::shared_ptr m_shader; +} // namespace resources +} // namespace engine - }; - -} +#endif \ No newline at end of file diff --git a/include/resources/mesh.hpp b/include/resources/mesh.hpp index 6111cf2..5cfdd91 100644 --- a/include/resources/mesh.hpp +++ b/include/resources/mesh.hpp @@ -1,51 +1,54 @@ -#pragma once - -#include "gfx.hpp" +#ifndef ENGINE_INCLUDE_RESOURCES_MESH_H_ +#define ENGINE_INCLUDE_RESOURCES_MESH_H_ #include #include - #include +#include "gfx.hpp" +#include "gfx_device.hpp" + namespace engine { - class GFXDevice; - - struct Vertex { - glm::vec3 pos; - glm::vec3 norm; - glm::vec2 uv; - }; -} - -namespace engine::resources { - -class Mesh { - -public: - Mesh(GFXDevice* gfx, const std::vector& vertices); - Mesh(GFXDevice* gfx, const std::vector& vertices, const std::vector& indices) - : m_gfx(gfx) - { - initMesh(vertices, indices); - } - ~Mesh(); - Mesh(const Mesh&) = delete; - Mesh& operator=(const Mesh&) = delete; - - const gfx::Buffer* getVB(); - const gfx::Buffer* getIB(); - uint32_t getCount(); - -private: - GFXDevice* const m_gfx; - - const gfx::Buffer* m_vb; - const gfx::Buffer* m_ib; - uint32_t m_count; - - void initMesh(const std::vector& vertices, const std::vector& indices); - +struct Vertex { + glm::vec3 pos; + glm::vec3 norm; + glm::vec2 uv; }; -} +} // namespace engine + +namespace engine { +namespace resources { + +class Mesh { + public: + Mesh(GFXDevice* gfx, const std::vector& vertices); + Mesh(GFXDevice* gfx, const std::vector& vertices, + const std::vector& indices) + : gfx_(gfx) { + InitMesh(vertices, indices); + } + ~Mesh(); + Mesh(const Mesh&) = delete; + Mesh& operator=(const Mesh&) = delete; + + const gfx::Buffer* GetVB(); + const gfx::Buffer* GetIB(); + uint32_t GetCount(); + + private: + GFXDevice* const gfx_; + + const gfx::Buffer* vb_; + const gfx::Buffer* ib_; + uint32_t count_; + + void InitMesh(const std::vector& vertices, + const std::vector& indices); +}; + +} // namespace resources +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/resources/shader.hpp b/include/resources/shader.hpp index 6850dbb..8efd508 100644 --- a/include/resources/shader.hpp +++ b/include/resources/shader.hpp @@ -1,37 +1,38 @@ -#pragma once +#ifndef ENGINE_INCLUDE_RESOURCES_SHADER_H_ +#define ENGINE_INCLUDE_RESOURCES_SHADER_H_ +#include "application.hpp" #include "gfx.hpp" +#include "gfx_device.hpp" namespace engine { - class GFXDevice; - struct RenderData; -} - -namespace engine::resources { +namespace resources { class Shader { + public: + // defines what vertex inputs are defined, position is always vec3 + struct VertexParams { + bool has_normal; // vec3 + bool has_tangent; // vec3 + bool has_color; // vec3 + bool has_uv0; // vec2 + }; -public: + Shader(RenderData* render_data, const char* vert_path, const char* frag_path, + const VertexParams& vertex_params, bool alpha_blending, + bool cull_backface); + ~Shader(); + Shader(const Shader&) = delete; + Shader& operator=(const Shader&) = delete; - // defines what vertex inputs are defined, position is always vec3 - struct VertexParams { - bool hasNormal; // vec3 - bool hasTangent; // vec3 - bool hasColor; // vec3 - bool hasUV0; // vec2 - }; - - Shader(RenderData* renderData, const char* vertPath, const char* fragPath, const VertexParams& vertexParams, bool alphaBlending, bool cullBackFace); - ~Shader(); - Shader(const Shader&) = delete; - Shader& operator=(const Shader&) = delete; - - const gfx::Pipeline* getPipeline(); - -private: - GFXDevice* const m_gfx; - const gfx::Pipeline* m_pipeline; + const gfx::Pipeline* GetPipeline(); + private: + GFXDevice* const gfx_; + const gfx::Pipeline* pipeline_; }; -} +} // namespace resources +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/resources/texture.hpp b/include/resources/texture.hpp index dab3173..51d249c 100644 --- a/include/resources/texture.hpp +++ b/include/resources/texture.hpp @@ -1,37 +1,39 @@ -#pragma once - -#include "gfx_device.hpp" +#ifndef ENGINE_INCLUDE_RESOURCES_TEXTURE_H_ +#define ENGINE_INCLUDE_RESOURCES_TEXTURE_H_ #include -namespace engine { - struct RenderData; -} +#include "application.hpp" +#include "gfx_device.hpp" -namespace engine::resources { +namespace engine { +namespace resources { class Texture { + public: + enum class Filtering { + kOff, + kBilinear, + kTrilinear, + kAnisotropic, + }; -public: - enum class Filtering { - OFF, - BILINEAR, - TRILINEAR, - ANISOTROPIC, - }; + Texture(RenderData* render_data, const std::string& path, + Filtering filtering); + ~Texture(); + Texture(const Texture&) = delete; + Texture& operator=(const Texture&) = delete; - Texture(RenderData* renderData, const std::string& path, Filtering filtering); - ~Texture(); - Texture(const Texture&) = delete; - Texture& operator=(const Texture&) = delete; + const gfx::Image* GetImage() { return image_; } + const gfx::DescriptorSet* GetDescriptorSet() { return descriptor_set_; } - const gfx::Image* getImage() { return m_image; } - const gfx::DescriptorSet* getDescriptorSet() { return m_descriptorSet; } - -private: - GFXDevice* m_gfxDevice; - const gfx::Image* m_image; - const gfx::DescriptorSet* m_descriptorSet; + private: + GFXDevice* gfx_; + const gfx::Image* image_; + const gfx::DescriptorSet* descriptor_set_; }; -} +} // namespace resources +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/systems/collisions.hpp b/include/systems/collisions.hpp index 4da2727..c53ade1 100644 --- a/include/systems/collisions.hpp +++ b/include/systems/collisions.hpp @@ -1,60 +1,61 @@ -#pragma once +#ifndef ENGINE_INCLUDE_SYSTEMS_COLLISIONS_H_ +#define ENGINE_INCLUDE_SYSTEMS_COLLISIONS_H_ #include -#include - #include +#include #include "components/collider.hpp" #include "ecs_system.hpp" namespace engine { - class PhysicsSystem : public System { +class PhysicsSystem : public System { + public: + PhysicsSystem(Scene* scene); - public: - PhysicsSystem(Scene* scene); + void OnUpdate(float ts) override; - void OnUpdate(float ts) override; + void OnComponentInsert(uint32_t entity) override; - void OnComponentInsert(uint32_t entity) override; + struct CollisionEvent { + bool is_collision_enter; // false == collision exit + uint32_t collided_entity; // the entity that this entity collided with + glm::vec3 normal; // the normal of the surface this entity collided with; + // ignored on collision exit + glm::vec3 point; // where the collision was detected + }; - struct CollisionEvent { - bool isCollisionEnter; // false == collision exit - uint32_t collidedEntity; // the entity that this entity collided with - glm::vec3 normal; // the normal of the surface this entity collided with; ignored on collision exit - glm::vec3 point; // where the collision was detected - }; - - private: + private: + // dynamic arrays to avoid realloc on every frame - // dynamic arrays to avoid realloc on every frame + // entity, aabb, is_trigger + std::vector> static_aabbs_{}; + std::vector> dynamic_aabbs_{}; - // entity, aabb, isTrigger - std::vector> m_staticAABBs{}; - std::vector> m_dynamicAABBs{}; + struct PossibleCollision { + PossibleCollision(uint32_t static_entity, AABB static_aabb, + bool static_trigger, uint32_t dynamic_entity, + AABB dynamic_aabb, bool dynamic_trigger) + : static_entity(static_entity), + static_aabb(static_aabb), + static_trigger(static_trigger), + dynamic_entity(dynamic_entity), + dynamic_aabb(dynamic_aabb), + dynamic_trigger(dynamic_trigger) {} - struct PossibleCollision { + uint32_t static_entity; + AABB static_aabb; + bool static_trigger; + uint32_t dynamic_entity; + AABB dynamic_aabb; + bool dynamic_trigger; + }; + std::vector possible_collisions_{}; + std::vector> + collision_infos_{}; // target entity, event info +}; - PossibleCollision(uint32_t staticEntity, AABB staticAABB, bool staticTrigger, uint32_t dynamicEntity, AABB dynamicAABB, bool dynamicTrigger) : - staticEntity(staticEntity), - staticAABB(staticAABB), - staticTrigger(staticTrigger), - dynamicEntity(dynamicEntity), - dynamicAABB(dynamicAABB), - dynamicTrigger(dynamicTrigger) {} - - uint32_t staticEntity; - AABB staticAABB; - bool staticTrigger; - uint32_t dynamicEntity; - AABB dynamicAABB; - bool dynamicTrigger; - }; - std::vector m_possibleCollisions{}; - std::vector> m_collisionInfos{}; // target entity, event info - - }; - -} +} // namespace engine +#endif \ No newline at end of file diff --git a/include/systems/render.hpp b/include/systems/render.hpp index 55e150a..b946dd8 100644 --- a/include/systems/render.hpp +++ b/include/systems/render.hpp @@ -1,43 +1,39 @@ -#pragma once +#ifndef ENGINE_INCLUDE_SYSTEMS_RENDER_H_ +#define ENGINE_INCLUDE_SYSTEMS_RENDER_H_ -#include "ecs_system.hpp" -#include "scene.hpp" -#include "log.hpp" - -#include "components/transform.hpp" #include "components/renderable.hpp" - +#include "components/transform.hpp" +#include "ecs_system.hpp" #include "gfx.hpp" #include "gfx_device.hpp" +#include "log.hpp" +#include "scene.hpp" namespace engine { - class RenderSystem : public System { +class RenderSystem : public System { + public: + RenderSystem(Scene* scene); + ~RenderSystem(); - public: - RenderSystem(Scene* scene); - ~RenderSystem(); + void OnUpdate(float ts) override; - void OnUpdate(float ts) override; + void SetCameraEntity(uint32_t entity); - void setCameraEntity(uint32_t entity); + private: + GFXDevice* const gfx_; - private: - GFXDevice* const m_gfx; + struct { + // only uses transform component, which is required for all entities anyway + uint32_t cam_entity = 0; + float vertical_fov_degrees = 70.0f; + float clip_near = 0.5f; + float clip_far = 10000.0f; + } camera_; - struct { - // only uses transform component, which is required for all entities anyway - uint32_t camEntity = 0; - float verticalFovDegrees = 70.0f; - float clipNear = 0.5f; - float clipFar = 10000.0f; - } m_camera; + float viewport_aspect_ratio_ = 1.0f; +}; - float m_viewportAspectRatio = 1.0f; - - float m_value = 0.0f; - - }; - -} +} // namespace engine +#endif \ No newline at end of file diff --git a/include/systems/render2d.hpp b/include/systems/render2d.hpp index 47d3d0f..35a3a95 100644 --- a/include/systems/render2d.hpp +++ b/include/systems/render2d.hpp @@ -1,20 +1,20 @@ -#pragma once +#ifndef ENGINE_INCLUDE_SYSTEMS_RENDER2D_H_ +#define ENGINE_INCLUDE_SYSTEMS_RENDER2D_H_ #include "ecs_system.hpp" namespace engine { - class Render2DSystem : public System { +class Render2DSystem : public System { + public: + Render2DSystem(Scene* scene); + ~Render2DSystem(); - public: - Render2DSystem(Scene* scene); - ~Render2DSystem(); + void OnUpdate(float ts) override; - void OnUpdate(float ts) override; + private: +}; - private: - - }; - -} +} // namespace engine +#endif \ No newline at end of file diff --git a/include/systems/transform.hpp b/include/systems/transform.hpp index c2d7688..82fd472 100644 --- a/include/systems/transform.hpp +++ b/include/systems/transform.hpp @@ -1,4 +1,5 @@ -#pragma once +#ifndef ENGINE_INCLUDE_SYSTEMS_TRANSFORM_H_ +#define ENGINE_INCLUDE_SYSTEMS_TRANSFORM_H_ #include "ecs_system.hpp" @@ -11,9 +12,10 @@ namespace engine { void OnUpdate(float ts) override; - uint32_t getChildEntity(uint32_t parent, const std::string& tag); + uint32_t GetChildEntity(uint32_t parent, const std::string& tag); }; } +#endif \ No newline at end of file diff --git a/include/systems/ui.hpp b/include/systems/ui.hpp index 09a34fb..1512916 100644 --- a/include/systems/ui.hpp +++ b/include/systems/ui.hpp @@ -1,19 +1,19 @@ -#pragma once +#ifndef ENGINE_INCLUDE_SYSTEMS_UI_H_ +#define ENGINE_INCLUDE_SYSTEMS_UI_H_ #include "ecs_system.hpp" namespace engine { - class UISystem : public System { +class UISystem : public System { + public: + UISystem(Scene* scene); - public: - UISystem(Scene* scene); + void OnUpdate(float ts) override; - void OnUpdate(float ts) override; + private: +}; - private: - - }; - -} +} // namespace engine +#endif \ No newline at end of file diff --git a/include/util/files.hpp b/include/util/files.hpp index f4d0215..18d714a 100644 --- a/include/util/files.hpp +++ b/include/util/files.hpp @@ -1,16 +1,22 @@ -#pragma once +#ifndef ENGINE_INCLUDE_UTIL_FILES_H_ +#define ENGINE_INCLUDE_UTIL_FILES_H_ #include -#include #include +#include -namespace engine::util { +namespace engine { +namespace util { - std::unique_ptr> readTextFile(const std::string& path); - std::unique_ptr> readBinaryFile(const std::string& path); +std::unique_ptr> ReadTextFile(const std::string& path); +std::unique_ptr> ReadBinaryFile(const std::string& path); - // Read an image file into a vector byte buffer. PNG and JPG support at a minimum. - // Output format is R8G8B8A8_UINT - std::unique_ptr> readImageFile(const std::string& path, int *width, int *height); +// Read an image file into a vector byte buffer. PNG and JPG support at a +// minimum. Output format is R8G8B8A8_UINT +std::unique_ptr> ReadImageFile(const std::string& path, + int* width, int* height); -} +} // namespace util +} // namespace engine + +#endif \ No newline at end of file diff --git a/include/util/model_loader.hpp b/include/util/model_loader.hpp index 2656616..ad7898a 100644 --- a/include/util/model_loader.hpp +++ b/include/util/model_loader.hpp @@ -1,13 +1,16 @@ -#pragma once - -#include "scene.hpp" - -#include "resources/shader.hpp" +#ifndef ENGINE_INCLUDE_UTIL_MODEL_LOADER_H_ +#define ENGINE_INCLUDE_UTIL_MODEL_LOADER_H_ #include -namespace engine::util { +#include "scene.hpp" - uint32_t loadMeshFromFile(Scene* parent, const std::string& path); +namespace engine { +namespace util { -} +uint32_t LoadMeshFromFile(Scene* parent, const std::string& path); + +} // namespace util +} // namespace engine + +#endif \ No newline at end of file diff --git a/src/application.cpp b/src/application.cpp index 2d2086a..16a3fbc 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -116,8 +116,8 @@ namespace engine { // default resources { resources::Shader::VertexParams vertParams{}; - vertParams.hasNormal = true; - vertParams.hasUV0 = true; + vertParams.has_normal = true; + vertParams.has_uv0 = true; auto texturedShader = std::make_unique( &render_data_, GetResourcePath("engine/shaders/standard.vert").c_str(), @@ -130,8 +130,8 @@ namespace engine { } { resources::Shader::VertexParams vertParams{}; - vertParams.hasNormal = true; - vertParams.hasUV0 = true; + vertParams.has_normal = true; + vertParams.has_uv0 = true; auto skyboxShader = std::make_unique( &render_data_, GetResourcePath("engine/shaders/skybox.vert").c_str(), @@ -146,7 +146,7 @@ namespace engine { auto whiteTexture = std::make_unique( &render_data_, GetResourcePath("engine/textures/white.png"), - resources::Texture::Filtering::OFF + resources::Texture::Filtering::kOff ); GetResourceManager()->AddPersistent("builtin.white", std::move(whiteTexture)); } diff --git a/src/gfx_device_vulkan.cpp b/src/gfx_device_vulkan.cpp index 19c9f15..e7564b8 100644 --- a/src/gfx_device_vulkan.cpp +++ b/src/gfx_device_vulkan.cpp @@ -832,8 +832,8 @@ namespace engine { gfx::Pipeline* pipeline = new gfx::Pipeline; - auto vertShaderCode = util::readTextFile(info.vert_shader_path); - auto fragShaderCode = util::readTextFile(info.frag_shader_path); + auto vertShaderCode = util::ReadTextFile(info.vert_shader_path); + auto fragShaderCode = util::ReadTextFile(info.frag_shader_path); VkShaderModule vertShaderModule = compileShader(pimpl->device.device, shaderc_vertex_shader, vertShaderCode->data(), info.vert_shader_path); VkShaderModule fragShaderModule = compileShader(pimpl->device.device, shaderc_fragment_shader, fragShaderCode->data(), info.frag_shader_path); diff --git a/src/resources/material.cpp b/src/resources/material.cpp index 8da996e..137be9c 100644 --- a/src/resources/material.cpp +++ b/src/resources/material.cpp @@ -5,13 +5,13 @@ namespace engine::resources { Material::Material(std::shared_ptr shader) - : m_shader(shader) + : shader_(shader) { } Material::Material(const Material& original) - : m_texture(original.m_texture), m_shader(original.m_shader) + : texture_(original.texture_), shader_(original.shader_) { } diff --git a/src/resources/mesh.cpp b/src/resources/mesh.cpp index 5720b6c..143c2bd 100644 --- a/src/resources/mesh.cpp +++ b/src/resources/mesh.cpp @@ -6,41 +6,41 @@ namespace engine::resources { Mesh::Mesh(GFXDevice* gfx, const std::vector& vertices) - : m_gfx(gfx) + : gfx_(gfx) { std::vector indices(vertices.size()); for (uint32_t i = 0; i < indices.size(); i++) { indices[i] = i; } - initMesh(vertices, indices); + InitMesh(vertices, indices); } Mesh::~Mesh() { - m_gfx->DestroyBuffer(m_ib); - m_gfx->DestroyBuffer(m_vb); + gfx_->DestroyBuffer(ib_); + gfx_->DestroyBuffer(vb_); } - const gfx::Buffer* Mesh::getVB() + const gfx::Buffer* Mesh::GetVB() { - return m_vb; + return vb_; } - const gfx::Buffer* Mesh::getIB() + const gfx::Buffer* Mesh::GetIB() { - return m_ib; + return ib_; } - uint32_t Mesh::getCount() + uint32_t Mesh::GetCount() { - return m_count; + return count_; } - void Mesh::initMesh(const std::vector& vertices, const std::vector& indices) + void Mesh::InitMesh(const std::vector& vertices, const std::vector& indices) { - m_vb = m_gfx->CreateBuffer(gfx::BufferType::kVertex, vertices.size() * sizeof(Vertex), vertices.data()); - m_ib = m_gfx->CreateBuffer(gfx::BufferType::kIndex, indices.size() * sizeof(uint32_t), indices.data()); - m_count = (uint32_t)indices.size(); + vb_ = gfx_->CreateBuffer(gfx::BufferType::kVertex, vertices.size() * sizeof(Vertex), vertices.data()); + ib_ = gfx_->CreateBuffer(gfx::BufferType::kIndex, indices.size() * sizeof(uint32_t), indices.data()); + count_ = (uint32_t)indices.size(); LOG_INFO("Loaded mesh, vertices: {}, indices: {}", vertices.size(), indices.size()); } diff --git a/src/resources/shader.cpp b/src/resources/shader.cpp index 8ed27fb..16cd580 100644 --- a/src/resources/shader.cpp +++ b/src/resources/shader.cpp @@ -10,7 +10,7 @@ namespace engine::resources { Shader::Shader(RenderData* renderData, const char* vertPath, const char* fragPath, const VertexParams& vertexParams, bool alphaBlending, bool cullBackFace) - : m_gfx(renderData->gfxdev.get()) + : gfx_(renderData->gfxdev.get()) { uint32_t index = 0; @@ -20,19 +20,19 @@ namespace engine::resources { vertFormat.attribute_descriptions.emplace_back(index++, gfx::VertexAttribFormat::kFloat3, stride); stride += 3 * sizeof(float); - if (vertexParams.hasNormal) { + if (vertexParams.has_normal) { vertFormat.attribute_descriptions.emplace_back(index++, gfx::VertexAttribFormat::kFloat3, stride); stride += 3 * sizeof(float); } - if (vertexParams.hasTangent) { + if (vertexParams.has_tangent) { vertFormat.attribute_descriptions.emplace_back(index++, gfx::VertexAttribFormat::kFloat4, stride); stride += 4 * sizeof(float); } - if (vertexParams.hasColor) { + if (vertexParams.has_color) { vertFormat.attribute_descriptions.emplace_back(index++, gfx::VertexAttribFormat::kFloat4, stride); stride += 4 * sizeof(float); } - if (vertexParams.hasUV0) { + if (vertexParams.has_uv0) { vertFormat.attribute_descriptions.emplace_back(index++, gfx::VertexAttribFormat::kFloat2, stride); stride += 2 * sizeof(float); } @@ -48,7 +48,7 @@ namespace engine::resources { info.descriptor_set_layouts.push_back(renderData->frame_set_layout); info.descriptor_set_layouts.push_back(renderData->material_set_layout); - m_pipeline = m_gfx->CreatePipeline(info); + pipeline_ = gfx_->CreatePipeline(info); LOG_INFO("Loaded shader: {}, vertex attribs: {}", vertPath, vertFormat.attribute_descriptions.size()); @@ -56,12 +56,12 @@ namespace engine::resources { Shader::~Shader() { - m_gfx->DestroyPipeline(m_pipeline); + gfx_->DestroyPipeline(pipeline_); } - const gfx::Pipeline* Shader::getPipeline() + const gfx::Pipeline* Shader::GetPipeline() { - return m_pipeline; + return pipeline_; } } diff --git a/src/resources/texture.cpp b/src/resources/texture.cpp index 2bd0610..751ee6e 100644 --- a/src/resources/texture.cpp +++ b/src/resources/texture.cpp @@ -9,45 +9,45 @@ namespace engine::resources { Texture::Texture(RenderData* renderData, const std::string& path, Filtering filtering) - : m_gfxDevice(renderData->gfxdev.get()) + : gfx_(renderData->gfxdev.get()) { int width, height; - std::unique_ptr> texbuf = util::readImageFile(path, &width, &height); + std::unique_ptr> texbuf = util::ReadImageFile(path, &width, &height); gfx::SamplerInfo samplerInfo{}; samplerInfo.magnify = gfx::Filter::kLinear; switch (filtering) { - case Filtering::OFF: + case Filtering::kOff: samplerInfo.minify = gfx::Filter::kNearest; samplerInfo.mipmap = gfx::Filter::kNearest; samplerInfo.anisotropic_filtering = false; break; - case Filtering::BILINEAR: + case Filtering::kBilinear: samplerInfo.minify = gfx::Filter::kLinear; samplerInfo.mipmap = gfx::Filter::kNearest; samplerInfo.anisotropic_filtering = false; break; - case Filtering::TRILINEAR: + case Filtering::kTrilinear: samplerInfo.minify = gfx::Filter::kLinear; samplerInfo.mipmap = gfx::Filter::kLinear; samplerInfo.anisotropic_filtering = false; break; - case Filtering::ANISOTROPIC: + case Filtering::kAnisotropic: samplerInfo.minify = gfx::Filter::kLinear; samplerInfo.mipmap = gfx::Filter::kLinear; samplerInfo.anisotropic_filtering = true; } if (renderData->samplers.contains(samplerInfo) == false) { - renderData->samplers.insert(std::make_pair(samplerInfo, m_gfxDevice->CreateSampler(samplerInfo))); + renderData->samplers.insert(std::make_pair(samplerInfo, gfx_->CreateSampler(samplerInfo))); } - m_image = m_gfxDevice->CreateImage(width, height, texbuf->data()); - m_descriptorSet = m_gfxDevice->AllocateDescriptorSet(renderData->material_set_layout); - m_gfxDevice->UpdateDescriptorCombinedImageSampler(m_descriptorSet, 0, m_image, renderData->samplers.at(samplerInfo)); + image_ = gfx_->CreateImage(width, height, texbuf->data()); + descriptor_set_ = gfx_->AllocateDescriptorSet(renderData->material_set_layout); + gfx_->UpdateDescriptorCombinedImageSampler(descriptor_set_, 0, image_, renderData->samplers.at(samplerInfo)); LOG_INFO("Loaded texture: {}, width: {} height: {}", path, width, height); @@ -55,7 +55,7 @@ Texture::Texture(RenderData* renderData, const std::string& path, Filtering filt Texture::~Texture() { - m_gfxDevice->DestroyImage(m_image); + gfx_->DestroyImage(image_); } } diff --git a/src/scene.cpp b/src/scene.cpp index 064418d..10b4c62 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -51,7 +51,7 @@ namespace engine { uint32_t Scene::getEntity(const std::string& tag, uint32_t parent) { - return GetSystem()->getChildEntity(parent, tag); + return GetSystem()->GetChildEntity(parent, tag); } size_t Scene::GetComponentSignaturePosition(size_t hash) diff --git a/src/systems/collisions.cpp b/src/systems/collisions.cpp index abb9982..3c093eb 100644 --- a/src/systems/collisions.cpp +++ b/src/systems/collisions.cpp @@ -75,10 +75,10 @@ namespace engine { { (void)entity; const size_t size = entities_.size(); - m_staticAABBs.reserve(size); - m_dynamicAABBs.reserve(size); - m_possibleCollisions.reserve(size); - m_collisionInfos.reserve(size); + static_aabbs_.reserve(size); + dynamic_aabbs_.reserve(size); + possible_collisions_.reserve(size); + collision_infos_.reserve(size); LOG_TRACE("added entity {} to collider system", entity); } @@ -86,16 +86,16 @@ namespace engine { { (void)ts; - m_staticAABBs.clear(); - m_dynamicAABBs.clear(); - m_possibleCollisions.clear(); - m_collisionInfos.clear(); + static_aabbs_.clear(); + dynamic_aabbs_.clear(); + possible_collisions_.clear(); + collision_infos_.clear(); for (uint32_t entity : entities_) { const auto t = scene_->GetComponent(entity); const auto c = scene_->GetComponent(entity); - const glm::vec3 globalPosition = t->worldMatrix[3]; + const glm::vec3 globalPosition = t->world_matrix[3]; const AABB localBoundingBox = c->aabb; AABB globalBoundingBox{}; globalBoundingBox.pos1 = globalPosition + localBoundingBox.pos1; @@ -106,10 +106,10 @@ namespace engine { if (a.pos1.y > a.pos2.y) std::swap(a.pos1.y, a.pos2.y); if (a.pos1.z > a.pos2.z) std::swap(a.pos1.z, a.pos2.z); - if (c->isStatic) { - m_staticAABBs.emplace_back(std::make_tuple(entity, globalBoundingBox, c->isTrigger)); + if (c->is_static) { + static_aabbs_.emplace_back(std::make_tuple(entity, globalBoundingBox, c->is_trigger)); } else { - m_dynamicAABBs.emplace_back(std::make_tuple(entity, globalBoundingBox, c->isTrigger)); + dynamic_aabbs_.emplace_back(std::make_tuple(entity, globalBoundingBox, c->is_trigger)); } } @@ -117,11 +117,11 @@ namespace engine { // Check every static collider against every dynamic collider, and every dynamic collider against every other one // This technique is inefficient for many entities. - for (const auto& [staticEntity, staticAABB, staticTrigger] : m_staticAABBs) { - for (const auto& [dynamicEntity, dynamicAABB, dynamicTrigger] : m_dynamicAABBs) { + for (const auto& [staticEntity, staticAABB, staticTrigger] : static_aabbs_) { + for (const auto& [dynamicEntity, dynamicAABB, dynamicTrigger] : dynamic_aabbs_) { if (checkCollisionFast(staticAABB, dynamicAABB)) { if (staticTrigger || dynamicTrigger) { // only check collisions involved with triggers - m_possibleCollisions.emplace_back( + possible_collisions_.emplace_back( staticEntity, staticAABB, staticTrigger, dynamicEntity, dynamicAABB, dynamicTrigger ); @@ -131,32 +131,32 @@ namespace engine { } // get collision details and submit events - for (const auto& possibleCollision : m_possibleCollisions) { - if (possibleCollision.staticTrigger) { + for (const auto& possibleCollision : possible_collisions_) { + if (possibleCollision.static_trigger) { CollisionEvent info{}; - info.isCollisionEnter = true; - info.collidedEntity = possibleCollision.dynamicEntity; - info.normal = getAABBNormal(possibleCollision.staticAABB, possibleCollision.dynamicAABB); + info.is_collision_enter = true; + info.collided_entity = possibleCollision.dynamic_entity; + info.normal = getAABBNormal(possibleCollision.static_aabb, possibleCollision.dynamic_aabb); - AABB object = possibleCollision.dynamicAABB; + AABB object = possibleCollision.dynamic_aabb; info.point = object.pos2; - m_collisionInfos.emplace_back(possibleCollision.staticEntity, info); + collision_infos_.emplace_back(possibleCollision.static_entity, info); } - if (possibleCollision.dynamicTrigger) { + if (possibleCollision.dynamic_trigger) { CollisionEvent info{}; - info.isCollisionEnter = true; - info.collidedEntity = possibleCollision.staticEntity; - info.normal = getAABBNormal(possibleCollision.dynamicAABB, possibleCollision.staticAABB); + info.is_collision_enter = true; + info.collided_entity = possibleCollision.static_entity; + info.normal = getAABBNormal(possibleCollision.dynamic_aabb, possibleCollision.static_aabb); - AABB object = possibleCollision.staticAABB; + AABB object = possibleCollision.static_aabb; info.point = object.pos2; - m_collisionInfos.emplace_back(possibleCollision.dynamicEntity, info); + collision_infos_.emplace_back(possibleCollision.dynamic_entity, info); } } - for (const auto& [entity, info] : m_collisionInfos) { + for (const auto& [entity, info] : collision_infos_) { scene_->event_system()->QueueEvent(EventSubscriberKind::kEntity, entity, info); } } diff --git a/src/systems/render.cpp b/src/systems/render.cpp index 823659c..7f30f74 100644 --- a/src/systems/render.cpp +++ b/src/systems/render.cpp @@ -16,7 +16,7 @@ namespace engine { RenderSystem::RenderSystem(Scene* scene) : System(scene, { typeid(TransformComponent).hash_code(), typeid(RenderableComponent).hash_code() }), - m_gfx(scene_->app()->gfxdev()) + gfx_(scene_->app()->gfxdev()) { } @@ -31,30 +31,30 @@ namespace engine { RenderData& renderData = scene_->app()->render_data_; /* camera stuff */ - const auto cameraTransform = scene_->GetComponent(m_camera.camEntity); + const auto cameraTransform = scene_->GetComponent(camera_.cam_entity); // do not render if camera is not set if (cameraTransform == nullptr) return; - glm::mat4 viewMatrix = glm::inverse(cameraTransform->worldMatrix); + glm::mat4 viewMatrix = glm::inverse(cameraTransform->world_matrix); if (scene_->app()->window()->GetWindowResized()) { uint32_t w, h; - m_gfx->GetViewportSize(&w, &h); - m_viewportAspectRatio = (float)w / (float)h; - const float verticalFovRadians = glm::radians(m_camera.verticalFovDegrees); - const glm::mat4 projMatrix = glm::perspectiveZO(verticalFovRadians, m_viewportAspectRatio, m_camera.clipNear, m_camera.clipFar); + gfx_->GetViewportSize(&w, &h); + viewport_aspect_ratio_ = (float)w / (float)h; + const float verticalFovRadians = glm::radians(camera_.vertical_fov_degrees); + const glm::mat4 projMatrix = glm::perspectiveZO(verticalFovRadians, viewport_aspect_ratio_, camera_.clip_near, camera_.clip_far); /* update SET 0 */ RenderData::GlobalSetUniformBuffer globalSetUniformBuffer{ .proj = projMatrix }; - m_gfx->WriteUniformBuffer(renderData.global_set_uniform_buffer, 0, sizeof(RenderData::GlobalSetUniformBuffer), &globalSetUniformBuffer); + gfx_->WriteUniformBuffer(renderData.global_set_uniform_buffer, 0, sizeof(RenderData::GlobalSetUniformBuffer), &globalSetUniformBuffer); } RenderData::FrameSetUniformBuffer frameSetUniformBuffer{ .view = viewMatrix }; - m_gfx->WriteUniformBuffer(renderData.frame_set_uniform_buffer, 0, sizeof(RenderData::FrameSetUniformBuffer), &frameSetUniformBuffer); + gfx_->WriteUniformBuffer(renderData.frame_set_uniform_buffer, 0, sizeof(RenderData::FrameSetUniformBuffer), &frameSetUniformBuffer); /* render all renderable entities */ @@ -76,52 +76,52 @@ namespace engine { auto r = scene_->GetComponent(entity); assert(r != nullptr); assert(r->material != nullptr); - assert(r->material->m_texture != nullptr); + assert(r->material->texture_ != nullptr); assert(r->mesh != nullptr); if (r->shown == false) continue; auto t = scene_->GetComponent(entity); assert(t != nullptr); - const gfx::Pipeline* pipeline = r->material->getShader()->getPipeline(); + const gfx::Pipeline* pipeline = r->material->GetShader()->GetPipeline(); DrawCallData data{}; - data.vb = r->mesh->getVB(); - data.ib = r->mesh->getIB(); - data.materialSet = r->material->m_texture->getDescriptorSet(); - data.indexCount = r->mesh->getCount(); - data.pushConsts.model = t->worldMatrix; + data.vb = r->mesh->GetVB(); + data.ib = r->mesh->GetIB(); + data.materialSet = r->material->texture_->GetDescriptorSet(); + data.indexCount = r->mesh->GetCount(); + data.pushConsts.model = t->world_matrix; pipelineDrawCalls[pipeline].push_back(data); } /* begin rendering */ - renderData.draw_buffer = m_gfx->BeginRender(); + renderData.draw_buffer = gfx_->BeginRender(); /* these descriptor set bindings should persist across pipeline changes */ const gfx::Pipeline* firstPipeline = pipelineDrawCalls.begin()->first; - m_gfx->CmdBindDescriptorSet(renderData.draw_buffer, firstPipeline, renderData.global_set, 0); - m_gfx->CmdBindDescriptorSet(renderData.draw_buffer, firstPipeline, renderData.frame_set, 1); + gfx_->CmdBindDescriptorSet(renderData.draw_buffer, firstPipeline, renderData.global_set, 0); + gfx_->CmdBindDescriptorSet(renderData.draw_buffer, firstPipeline, renderData.frame_set, 1); for (const auto& [pipeline, drawCalls] : pipelineDrawCalls) { - m_gfx->CmdBindPipeline(renderData.draw_buffer, pipeline); + gfx_->CmdBindPipeline(renderData.draw_buffer, pipeline); for (const auto& drawCall : drawCalls) { - m_gfx->CmdBindDescriptorSet(renderData.draw_buffer, pipeline, drawCall.materialSet, 2); - m_gfx->CmdPushConstants(renderData.draw_buffer, pipeline, 0, sizeof(PushConstants), &drawCall.pushConsts); - m_gfx->CmdBindVertexBuffer(renderData.draw_buffer, 0, drawCall.vb); - m_gfx->CmdBindIndexBuffer(renderData.draw_buffer, drawCall.ib); - m_gfx->CmdDrawIndexed(renderData.draw_buffer, drawCall.indexCount, 1, 0, 0, 0); + gfx_->CmdBindDescriptorSet(renderData.draw_buffer, pipeline, drawCall.materialSet, 2); + gfx_->CmdPushConstants(renderData.draw_buffer, pipeline, 0, sizeof(PushConstants), &drawCall.pushConsts); + gfx_->CmdBindVertexBuffer(renderData.draw_buffer, 0, drawCall.vb); + gfx_->CmdBindIndexBuffer(renderData.draw_buffer, drawCall.ib); + gfx_->CmdDrawIndexed(renderData.draw_buffer, drawCall.indexCount, 1, 0, 0, 0); } } /* draw */ - m_gfx->FinishRender(renderData.draw_buffer); + gfx_->FinishRender(renderData.draw_buffer); } - void RenderSystem::setCameraEntity(uint32_t entity) + void RenderSystem::SetCameraEntity(uint32_t entity) { - m_camera.camEntity = entity; + camera_.cam_entity = entity; } } diff --git a/src/systems/transform.cpp b/src/systems/transform.cpp index daf24f9..57011be 100644 --- a/src/systems/transform.cpp +++ b/src/systems/transform.cpp @@ -30,14 +30,14 @@ namespace engine { transform = glm::scale(transform, t->scale); if (t->parent != 0) { - transform = scene_->GetComponent(t->parent)->worldMatrix * transform; + transform = scene_->GetComponent(t->parent)->world_matrix * transform; } - t->worldMatrix = transform; + t->world_matrix = transform; } } - uint32_t TransformSystem::getChildEntity(uint32_t parent, const std::string& tag) + uint32_t TransformSystem::GetChildEntity(uint32_t parent, const std::string& tag) { for (uint32_t entity : entities_) { auto t = scene_->GetComponent(entity); diff --git a/src/util/files.cpp b/src/util/files.cpp index 422666e..049c349 100644 --- a/src/util/files.cpp +++ b/src/util/files.cpp @@ -7,7 +7,7 @@ namespace engine::util { - std::unique_ptr> readTextFile(const std::string& path) + std::unique_ptr> ReadTextFile(const std::string& path) { auto buffer = std::make_unique>(); @@ -33,7 +33,7 @@ namespace engine::util { return buffer; } - std::unique_ptr> readBinaryFile(const std::string& path) + std::unique_ptr> ReadBinaryFile(const std::string& path) { std::ifstream file(path, std::ios::ate | std::ios::binary); if (file.is_open() == false) { @@ -51,7 +51,7 @@ namespace engine::util { return buffer; } - std::unique_ptr> readImageFile(const std::string& path, int *width, int *height) + std::unique_ptr> ReadImageFile(const std::string& path, int *width, int *height) { int x, y, n; unsigned char *data = stbi_load(path.c_str(), &x, &y, &n, STBI_rgb_alpha); diff --git a/src/util/model_loader.cpp b/src/util/model_loader.cpp index 86e31a3..c32382a 100644 --- a/src/util/model_loader.cpp +++ b/src/util/model_loader.cpp @@ -79,9 +79,9 @@ namespace engine::util { childRenderer->mesh = meshes[parentNode->mMeshes[i]]; childRenderer->material = std::make_shared(scene->app()->GetResource("builtin.standard")); if (textures.contains(meshTextureIndices[parentNode->mMeshes[i]])) { - childRenderer->material->m_texture = textures.at(meshTextureIndices[parentNode->mMeshes[i]]); + childRenderer->material->texture_ = textures.at(meshTextureIndices[parentNode->mMeshes[i]]); } else { - childRenderer->material->m_texture = scene->app()->GetResource("builtin.white"); + childRenderer->material->texture_ = scene->app()->GetResource("builtin.white"); } } @@ -97,7 +97,7 @@ namespace engine::util { } } - uint32_t loadMeshFromFile(Scene* parent, const std::string& path) + uint32_t LoadMeshFromFile(Scene* parent, const std::string& path) { Assimp::Importer importer; @@ -183,7 +183,7 @@ namespace engine::util { try { textures[i] = std::make_shared( &parent->app()->render_data_, absPath.string(), - resources::Texture::Filtering::TRILINEAR); + resources::Texture::Filtering::kTrilinear); } catch (const std::runtime_error&) { textures[i] = parent->app()->GetResource("builtin.white"); } diff --git a/test/src/camera_controller.cpp b/test/src/camera_controller.cpp index 48c0168..8dddb24 100644 --- a/test/src/camera_controller.cpp +++ b/test/src/camera_controller.cpp @@ -178,7 +178,7 @@ void CameraControllerSystem::OnUpdate(float ts) // called once per frame void CameraControllerSystem::OnEvent(engine::PhysicsSystem::CollisionEvent info) { - c->justCollided = info.isCollisionEnter; + c->justCollided = info.is_collision_enter; c->lastCollisionNormal = info.normal; c->lastCollisionPoint = info.point; } diff --git a/test/src/game.cpp b/test/src/game.cpp index 448aa00..cead568 100644 --- a/test/src/game.cpp +++ b/test/src/game.cpp @@ -70,8 +70,8 @@ void playGame(GameSettings settings) auto camera = myScene->CreateEntity("camera"); myScene->GetComponent(camera)->position = { 0.0f, 10.0f, 0.0f }; auto cameraCollider = myScene->AddComponent(camera); - cameraCollider->isStatic = false; - cameraCollider->isTrigger = true; + cameraCollider->is_static = false; + cameraCollider->is_trigger = true; cameraCollider->aabb = { { -0.2f, -1.5f, -0.2f }, { 0.2f, 0.2f, 0.2f} }; // Origin is at eye level myScene->AddComponent(camera); myScene->event_system()->SubscribeToEventType( @@ -79,19 +79,19 @@ void playGame(GameSettings settings) ); auto renderSystem = myScene->GetSystem(); - renderSystem->setCameraEntity(camera); + renderSystem->SetCameraEntity(camera); } /* shared resources */ auto grassTexture = std::make_shared( &app.render_data_, app.GetResourcePath("textures/grass.jpg"), - engine::resources::Texture::Filtering::ANISOTROPIC + engine::resources::Texture::Filtering::kAnisotropic ); auto spaceTexture = std::make_shared( &app.render_data_, app.GetResourcePath("textures/space2.png"), - engine::resources::Texture::Filtering::ANISOTROPIC + engine::resources::Texture::Filtering::kAnisotropic ); /* cube */ @@ -100,10 +100,10 @@ void playGame(GameSettings settings) myScene->GetComponent(cube)->position = glm::vec3{ -0.5f + 5.0f, -0.5f + 5.0f, -0.5f + 5.0f }; auto cubeRenderable = myScene->AddComponent(cube); cubeRenderable->material = std::make_shared(app.GetResource("builtin.standard")); - cubeRenderable->material->m_texture = app.GetResource("builtin.white"); + cubeRenderable->material->texture_ = app.GetResource("builtin.white"); cubeRenderable->mesh = genCuboidMesh(app.gfxdev(), 1.0f, 1.0f, 1.0f, 1); auto cubeCollider = myScene->AddComponent(cube); - cubeCollider->isStatic = true; + cubeCollider->is_static = true; cubeCollider->aabb = { { 0.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 1.0f } }; } @@ -113,22 +113,22 @@ void playGame(GameSettings settings) myScene->GetComponent(floor)->position = glm::vec3{-5000.0f, -1.0f, -5000.0f}; auto floorRenderable = myScene->AddComponent(floor); floorRenderable->material = std::make_shared(app.GetResource("builtin.standard")); - floorRenderable->material->m_texture = grassTexture; + floorRenderable->material->texture_ = grassTexture; floorRenderable->mesh = genCuboidMesh(app.gfxdev(), 10000.0f, 1.0f, 10000.0f, 5000.0f); floorRenderable->shown = true; auto floorCollider = myScene->AddComponent(floor); - floorCollider->isStatic = true; + floorCollider->is_static = true; floorCollider->aabb = { { 0.0f, 0.0f, 0.0f }, { 10000.0f, 1.0f, 10000.0f } }; } - //engine::util::loadMeshFromFile(myScene, app.GetResourcePath("models/astronaut/astronaut.dae")); + //engine::util::LoadMeshFromFile(myScene, app.GetResourcePath("models/astronaut/astronaut.dae")); /* skybox */ { uint32_t skybox = myScene->CreateEntity("skybox"); auto skyboxRenderable = myScene->AddComponent(skybox); skyboxRenderable->material = std::make_unique(app.GetResource("builtin.skybox")); - skyboxRenderable->material->m_texture = spaceTexture; + skyboxRenderable->material->texture_ = spaceTexture; skyboxRenderable->mesh = genCuboidMesh(app.gfxdev(), 10.0f, 10.0f, 10.0f, 1.0f, true); myScene->GetComponent(skybox)->position = { -5.0f, -5.0f, -5.0f }; }