Skip to content

Commit

Permalink
[entity][infra] removed v1 directory - moved builtin to modules + dem…
Browse files Browse the repository at this point in the history
…o_scenes URI in scene6
  • Loading branch information
gabekz committed Dec 6, 2023
1 parent c2c96db commit 0af2adf
Show file tree
Hide file tree
Showing 44 changed files with 115 additions and 109 deletions.
72 changes: 39 additions & 33 deletions demo/demo_hot/demo_scenes.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#include "util/filesystem.h"

#include "entity/v1/builtin/component_test.h"
#include "entity/v1/builtin/components.h"
#include "entity/v1/ecs.h"
#include "entity/modules/component_test.h"
#include "entity/modules/components.h"
#include "entity/ecs.h"

#define LOAD_SCENE(index) GLUE(_scene, index)(ecs, renderer)

Expand Down Expand Up @@ -464,26 +464,32 @@ _scene6(gsk_ECS *ecs, gsk_Renderer *renderer)
ecs = gsk_renderer_active_scene(renderer, 6);
__set_active_scene_skybox(renderer, skyboxMain);

gsk_Texture *texContDiff = texture_create_d(
"../demo/demo_hot/Resources/textures/container/diffuse.png");
gsk_Texture *texContSpec = texture_create_n(
"../demo/demo_hot/Resources/textures/container/specular.png");
gsk_Texture *texContDiff =
texture_create_d(GSK_PATH("data://textures/container/diffuse.png"));
gsk_Texture *texContSpec =
texture_create_n(GSK_PATH("data://textures/container/specular.png"));

gsk_Texture *texBrickDiff = texture_create_d(
"../demo/demo_hot/Resources/textures/brickwall/diffuse.png");
gsk_Texture *texBrickNorm = texture_create_n(
"../demo/demo_hot/Resources/textures/brickwall/normal.png");
gsk_Texture *texBrickDiff =
texture_create_d(GSK_PATH("data://textures/brickwall/diffuse.png"));
gsk_Texture *texBrickNorm =
texture_create_n(GSK_PATH("data://textures/brickwall/normal.png"));

gsk_Model *model_plane =
gsk_model_load_from_file(GSK_PATH("gsk://models/plane.obj"), 1, FALSE);

gsk_Model *model_sphere =
gsk_model_load_from_file(GSK_PATH("gsk://models/sphere.obj"), 1, FALSE);

gsk_Material *matFloor =
gsk_material_create(NULL,
"../res/shaders/lit-diffuse.shader",
GSK_PATH("gsk://shaders/lit-diffuse.shader"),
3,
texBrickDiff,
texBrickNorm,
texDefSpec);
gsk_Material *matBox =
gsk_material_create(NULL,
"../res/shaders/lit-diffuse.shader",
GSK_PATH("gsk://shaders/lit-diffuse.shader"),
3,
texContDiff,
texDefNorm,
Expand Down Expand Up @@ -513,8 +519,8 @@ _scene6(gsk_ECS *ecs, gsk_Renderer *renderer)
_gsk_ecs_add_internal(
floorEntity,
C_MODEL,
(void *)(&(struct ComponentModel) {.material = matFloor,
.modelPath = "../res/models/plane.obj",
(void *)(&(struct ComponentModel) {.material = matFloor,
.pModel = model_plane,
.properties = {
.drawMode = DRAW_ARRAYS,
.cullMode = CULL_CW | CULL_FORWARD,
Expand Down Expand Up @@ -544,15 +550,15 @@ _scene6(gsk_ECS *ecs, gsk_Renderer *renderer)
.type = 1,
}));

_gsk_ecs_add_internal(sphereEntity,
C_MODEL,
(void *)(&(struct ComponentModel) {
.material = matBox,
.modelPath = "../res/models/sphere.obj",
.properties = {
.drawMode = DRAW_ARRAYS,
.cullMode = CULL_CW | CULL_FORWARD,
}}));
_gsk_ecs_add_internal(
sphereEntity,
C_MODEL,
(void *)(&(struct ComponentModel) {.material = matBox,
.pModel = model_sphere,
.properties = {
.drawMode = DRAW_ARRAYS,
.cullMode = CULL_CW | CULL_FORWARD,
}}));
// Second sphere
#if 1

Expand Down Expand Up @@ -580,15 +586,15 @@ _scene6(gsk_ECS *ecs, gsk_Renderer *renderer)
.type = 1,
}));

_gsk_ecs_add_internal(sphereEntity2,
C_MODEL,
(void *)(&(struct ComponentModel) {
.material = matBox,
.modelPath = "../res/models/sphere.obj",
.properties = {
.drawMode = DRAW_ARRAYS,
.cullMode = CULL_CW | CULL_FORWARD,
}}));
_gsk_ecs_add_internal(
sphereEntity2,
C_MODEL,
(void *)(&(struct ComponentModel) {.material = matBox,
.pModel = model_sphere,
.properties = {
.drawMode = DRAW_ARRAYS,
.cullMode = CULL_CW | CULL_FORWARD,
}}));
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions demo/demo_hot/demo_scenes.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define H_DEMO_SCENES

#include "core/graphics/renderer/v1/renderer.h"
#include "entity/v1/ecs.h"
#include "entity/ecs.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -26,7 +26,7 @@ enum DEMO_SCENE_NAMES {
#define DEMO_SCENES_TOTAL 7

#define LOAD_ALL_SCENES 0
#define INITIAL_SCENE 7
#define INITIAL_SCENE 6

#define DEMO_USING_AUDIO 0
#define DEMO_USING_MULTIPLE_CAMERAS 0
Expand Down
2 changes: 1 addition & 1 deletion goodsack/gsk/gsk/core/graphics/renderer/v1/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "core/graphics/ui/gui_element.h"
#include "core/graphics/ui/gui_text.h"

#include "entity/v1/ecs.h"
#include "entity/ecs.h"

#include "core/device/device.h"
#include "core/device/device_context.h"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion goodsack/gsk/gsk/entity/component/ecs_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ entity::ECSComponentLayout::SetData(std::map<std::string, Accessor> data)
m_SizeReq = sizeReq;
}

#include <entity/v1/ecs.h>
#include <entity/ecs.h>
entity::ECSComponentList::ECSComponentList(ECSComponentType componentTypeIndex,
ECSComponentLayout &layout)
: m_componentLayout(layout)
Expand Down
2 changes: 1 addition & 1 deletion goodsack/gsk/gsk/entity/component/ecs_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "util/maths.h"
#include "util/sysdefs.h"

#include "entity/v1/ecs.h"
#include "entity/ecs.h"

namespace entity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

#include "util/sysdefs.h"

#include "entity/v1/builtin/animator/animator.h"
#include "entity/v1/builtin/audio/audio_listener.h"
#include "entity/v1/builtin/audio/audio_source.h"
#include "entity/v1/builtin/camera/camera.h"
#include "entity/v1/builtin/component_test.h"
#include "entity/v1/builtin/model/model_draw.h"
#include "entity/v1/builtin/transform/transform.h"
#include "entity/modules/animator/animator.h"
#include "entity/modules/audio/audio_listener.h"
#include "entity/modules/audio/audio_source.h"
#include "entity/modules/camera/camera.h"
#include "entity/modules/component_test.h"
#include "entity/modules/model/model_draw.h"
#include "entity/modules/transform/transform.h"

// Physics
#include "entity/v1/builtin/physics/collider_setup-system.h"
#include "entity/v1/builtin/physics/rigidbody-system.h"
#include "entity/modules/physics/collider_setup-system.h"
#include "entity/modules/physics/rigidbody-system.h"

#if USING_GENERATED_COMPONENTS
#define COMPONENTS_GEN_IMPLEMENTATION
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion goodsack/gsk/gsk/entity/lua/__tests__/eventstore-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "entity/ecsdefs.h"
#include "entity/lua/eventstore.hpp"
#include "entity/v1/ecs.h"
#include "entity/ecs.h"

// TODO: Move to thirdparty directive - gabekz/GoodsackEngine#19
#include <gtest/gtest.h>
Expand Down
2 changes: 1 addition & 1 deletion goodsack/gsk/gsk/entity/lua/eventstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "entity/component/ecs_component.hpp"
#include "entity/component/ecs_component_layout_loader.hpp"
#include "entity/v1/ecs.h"
#include "entity/ecs.h"

#define EVENTSTORE_LUA_VEC3_CLASS 1

Expand Down
2 changes: 1 addition & 1 deletion goodsack/gsk/gsk/entity/lua/eventstore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <map>
#include <string>

#include <entity/v1/ecs.h>
#include <entity/ecs.h>

namespace entity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "animator.h"

#include "core/graphics/mesh/animation.h"
#include "entity/v1/builtin/components.h"
#include "entity/modules/components.h"

#include "core/device/device.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define __ANIMATOR_H__

#include "core/graphics/mesh/animation.h"
#include "entity/v1/ecs.h"
#include "entity/ecs.h"

#if !(USING_GENERATED_COMPONENTS)
struct ComponentAnimator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "core/drivers/alsoft/alsoft.h"
#include "core/drivers/alsoft/alsoft_debug.h"

#include "entity/v1/builtin/transform/transform.h"
#include "entity/modules/transform/transform.h"

// TODO: Move to thirdparty directive - gabekz/GoodsackEngine#19
#include <AL/al.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef __AUDIO_LISTENER_H__
#define __AUDIO_LISTENER_H__

#include "entity/v1/ecs.h"
#include "entity/ecs.h"

#if !(USING_GENERATED_COMPONENTS)
struct ComponentAudioListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "core/drivers/alsoft/alsoft.h"
#include "core/drivers/alsoft/alsoft_debug.h"

#include "entity/v1/builtin/camera/camera.h"
#include "entity/v1/builtin/transform/transform.h"
#include "entity/modules/camera/camera.h"
#include "entity/modules/transform/transform.h"

static void
init(gsk_Entity e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define __AUDIO_SOURCE_H__

#include "core/drivers/alsoft/alsoft.h"
#include "entity/v1/ecs.h"
#include "entity/ecs.h"

#if !(USING_GENERATED_COMPONENTS)
typedef struct ComponentAudioSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include "util/gfx.h"

#include "core/device/device.h"
#include "entity/v1/builtin/camera/camera_input.h"
#include "entity/v1/builtin/transform/transform.h"
#include "entity/v1/ecs.h"
#include "entity/modules/camera/camera_input.h"
#include "entity/modules/transform/transform.h"
#include "entity/ecs.h"

#define CAMERA_SHAKE 1
#define CAMERA_SENSITIVITY_DIVS 10.0f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <util/maths.h>
#include <util/sysdefs.h>

#include <entity/v1/ecs.h>
#include <entity/ecs.h>

#if !(USING_GENERATED_COMPONENTS)
struct ComponentCamera
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "util/logger.h"

#include "core/device/device.h"
#include "entity/v1/builtin/transform/transform.h"
#include "entity/modules/transform/transform.h"

void
camera_input(gsk_Entity cameraEntity, GLFWwindow *window)
Expand Down
26 changes: 26 additions & 0 deletions goodsack/gsk/gsk/entity/modules/components.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2022-2023, Gabriel Kutuzov
* SPDX-License-Identifier: MIT
*/

#ifndef __COMPONENTS_H__
#define __COMPONENTS_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "entity/modules/camera/camera.h"
#include "entity/modules/model/model.h"
#include "entity/modules/transform/transform.h"

#include "entity/modules/audio/audio_listener.h"
#include "entity/modules/audio/audio_source.h"

#include "entity/modules/animator/animator.h"

#ifdef __cplusplus
}
#endif

#endif // __COMPONENTS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "core/graphics/mesh/mesh.h"
#include "core/graphics/mesh/model.h"

#include "entity/v1/ecs.h"
#include "entity/ecs.h"

#define CULL_DISABLED 0x10
#define CULL_CW 0x00
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "model_draw.h"

#include "asset/import/loader_obj.h"
#include "entity/v1/builtin/model/model.h"
#include "entity/v1/builtin/transform/transform.h"
#include "entity/v1/ecs.h"
#include "entity/modules/model/model.h"
#include "entity/modules/transform/transform.h"
#include "entity/ecs.h"

#include "core/device/device.h"
#include "core/graphics/mesh/mesh.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef __MODEL_DRAW_H__
#define __MODEL_DRAW_H__

#include "entity/v1/ecs.h"
#include "entity/ecs.h"

void
s_model_draw_init(gsk_ECS *ecs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef __COLLIDER_SETUP_SYSTEM_H__
#define __COLLIDER_SETUP_SYSTEM_H__

#include "entity/v1/ecs.h"
#include "entity/ecs.h"

void
s_collider_setup_system_init(gsk_ECS *ecs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef __RIGIDBODY_SYSTEM_H__
#define __RIGIDBODY_SYSTEM_H__

#include "entity/v1/ecs.h"
#include "entity/ecs.h"

void
s_rigidbody_system_init(gsk_ECS *ecs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "transform.h"

#include "core/graphics/shader/shader.h"
#include "entity/v1/ecs.h"
#include "entity/ecs.h"

// #define ECS_SYSTEM
// ECS_SYSTEM_DECLARE()
Expand Down
Loading

0 comments on commit 0af2adf

Please sign in to comment.