diff --git a/include/fennec/containers/bintree.h b/include/fennec/containers/bintree.h index 840afef..b103abf 100644 --- a/include/fennec/containers/bintree.h +++ b/include/fennec/containers/bintree.h @@ -35,11 +35,8 @@ #include #include #include -#include #include -// TODO: this should probably be refactored to use pointers over tables - namespace fennec { diff --git a/include/fennec/scene/component.h b/include/fennec/scene/component.h index 190a0ba..c1cb442 100644 --- a/include/fennec/scene/component.h +++ b/include/fennec/scene/component.h @@ -241,15 +241,15 @@ public: /// \param type The type of component /// \param id The id of the component instance /// \return - static component* get(uint64_t type, size_t id) { - auto& typei = _typelist[type]; - return typei->get(id); + static component* get(const component_t& c) { + auto& typei = _typelist[c.type]; + return typei->get(c.id); } template - static component* get(size_t comp) { + static component* get(size_t id) { auto& typei = _typelist[uuid()]; - return typei->get(comp); + return typei->get(id); } static void destroy(size_t type, size_t comp) { diff --git a/planning/3D_GRAPHICS.md b/planning/3D_GRAPHICS.md index 71e817d..e8afc67 100644 --- a/planning/3D_GRAPHICS.md +++ b/planning/3D_GRAPHICS.md @@ -57,7 +57,7 @@ struct Object { vec3 location, scale; // A matrix would be 64 bytes, this is instead 28 bytes quat rotation; - uint32 material, lighting; + uint32 lighting; } ``` @@ -68,42 +68,6 @@ Objects are identified with a manually provided type and ID. Object types includ A user should never have to specify these and should be automatically generated by the respective components. -Textures for 3D rendering are stored in various buffers with sizes of powers of 2. Ratios of `1:1` -`2:1`, and `4:1` are allowed. The `2:1` ratio is specifically for spherical and cylindrical projection. UVs -may be transformed to use a `2:1` as if it were `1:2`. Same applies for `4:1` -Cubemaps and 3D textures may only be `1:1`. - -- 8-Bit R Texture `4096, 2048, 1024, 512` (8) -- 8-Bit RG Texture `4096, 2048, 1024, 512` (8) -- 8-Bit RGB Texture `4096, 2048, 1024, 512` (8) -- 8-Bit RGBA Texture `4096, 2048, 1024, 512` (8) -- 8-Bit R Cubemap `1024, 512, 256, 128` (4) -- 8-Bit RGB Cubemap `1024, 512, 256, 128` (4) - -* 16-Bit HDR R Texture `4096, 2048, 1024, 512` (8) -* 16-Bit HDR RGB Texture `4096, 2048, 1024, 512` (8) -* 16-Bit HDR RGBA Texture `4096, 2048, 1024, 512` (8) -* 16-Bit HDR R Cubemap `1024, 512, 256, 128` (4) -* 16-Bit HDR RGB Cubemap `1024, 512, 256, 128` (4) - -- 16-Bit Shadow Texture `4096, 2048, 1024, 512` (8) -- 16-Bit Shadow Cubemap `2048, 1024, 512, 256` (4) - -* 8-Bit 3D R Texture `256, 128, 64, 32` (4) -* 8-Bit 3D RGB Texture `256, 128, 64, 32` (4) -* 16-Bit 3D HDR R Texture `256, 128, 64, 32` (4) -* 16-Bit 3D HDR RGB Texture `256, 128, 64, 32` (4) - -Documentation should provide guidelines on categories of Art Assets and the resolution of textures to use. - -Textures are identified by a 32-bit integer. -- `8 bits` → the texture buffer -- `24 bits` → the layer in the buffer - -Artists should be informed on the texture structure of the engine and its limitations. -However, these principles should be followed in other game engines as these are -guided by what is most efficient for typical GPU hardware. - Materials are, for the most part, user-defined. Documentation should make the user aware of this. Material buffers will be a sequence of the Material Struct instances. @@ -118,6 +82,28 @@ Types of materials: - Post-Process +Each Material will have a buffer of Objects so that +each can be rendered in a single draw call. + + +## Lighting + +When Dynamic Lighting is enabled, each light has two textures, +one for static lighting and one for dynamic lighting. + + +Shadows + + - Directional Light → 16-bit Shadow Texture `4096` + - Spotlights → 16-bit Shadow Texture `2048` + - Point Lights → 16-bit Shadow Cubemap `1024` + - Area Lights → 16-bit Shadow Texture `2048` + + +Reflections + + - Light Probe → 16-bit RGB Cubemap `512, 256` + ## Stages