![]() |
Blamite Game Engine - blam!
00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
|
#include "components/rendering/rendering.h"#include "api/v1/types/tags/classes/material.h"#include "components/resources/engine_globals/globals.h"#include "components/rendering/bgfx/shader_flags.h"#include <chrono>
Include dependency graph for materials.cpp:Classes | |
| struct | pbr_uniform_data |
| struct | unlit_uniform_data |
Macros | |
| #define | PBR_SLOT_PARAMS_0 0 |
| #define | PBR_SLOT_PARAMS_1 1 |
| #define | PBR_SLOT_PARAMS_2 2 |
| #define | PBR_SLOT_PARAMS_3 3 |
| #define | PBR_SLOT_CLEAR_COAT 4 |
| #define | PBR_SLOT_DETAIL_PARAMS 5 |
| #define | PBR_SLOT_UV_ALBEDO 6 |
| #define | PBR_SLOT_UV_NORMAL 7 |
| #define | PBR_SLOT_UV_METAL_ROUGH 8 |
| #define | PBR_SLOT_UV_OCCLUSION 9 |
| #define | PBR_SLOT_UV_EMISSIVE 10 |
| #define | PBR_SLOT_UV_SPECULAR 11 |
| #define | PBR_SLOT_UV_DETAIL_0 12 |
| #define | PBR_SLOT_UV_DETAIL_1 13 |
| #define | PBR_SLOT_UV_DETAIL_2 14 |
| #define | PBR_SLOT_UV_DETAIL_3 15 |
| #define | PBR_SLOT_UV_DETAIL_NORM_0 16 |
| #define | PBR_SLOT_UV_DETAIL_NORM_1 17 |
| #define | PBR_SLOT_UV_DETAIL_NORM_2 18 |
| #define | PBR_SLOT_UV_DETAIL_NORM_3 19 |
| #define | PBR_SLOT_UV_DETAIL_WEIGHT 20 |
| #define | SET_PACKED_SLOT(slot_idx, x_, y_, z_, w_) |
Functions | |
| material_filter_modes | resolve_min_filter (material_filter_modes material_filter, bitmap *bitmap_tag) |
| Resolves the effective minification filter mode by combining the material's requested filter mode with the bitmap tag's filter mode and force flag. More... | |
| material_filter_modes | resolve_mag_filter (material_filter_modes material_filter, bitmap *bitmap_tag) |
| Resolves the effective magnification filter mode using the same inheritance rules as resolve_min_filter, but consulting the magnification-specific tag fields and force flag. More... | |
| material_filter_modes | resolve_mip_filter (material_filter_modes material_filter, bitmap *bitmap_tag) |
| Resolves the effective mip filter mode using the same inheritance rules as resolve_min_filter, but consulting the mip-specific tag fields and force flag. More... | |
| uint64_t | build_sampler_flags (material_filter_modes min_filter, material_filter_modes mag_filter, material_filter_modes mip_filter, material_wrap_modes wrap_x, material_wrap_modes wrap_y, material_wrap_modes wrap_z) |
| Computes the bgfx sampler flag bits that correspond to the requested min/mag/mip filter modes and wrap modes for one texture. More... | |
| uint64_t | compute_sampler_flags_for_texture (material_filter_modes material_min, material_filter_modes material_mag, material_filter_modes material_mip, material_wrap_modes wrap_x, material_wrap_modes wrap_y, material_wrap_modes wrap_z, bitmap *bitmap_tag) |
| Computes the final bgfx sampler flags for one material texture binding. More... | |
| #define PBR_SLOT_CLEAR_COAT 4 |
| #define PBR_SLOT_DETAIL_PARAMS 5 |
| #define PBR_SLOT_PARAMS_0 0 |
| #define PBR_SLOT_PARAMS_1 1 |
| #define PBR_SLOT_PARAMS_2 2 |
| #define PBR_SLOT_PARAMS_3 3 |
| #define PBR_SLOT_UV_ALBEDO 6 |
| #define PBR_SLOT_UV_DETAIL_0 12 |
| #define PBR_SLOT_UV_DETAIL_1 13 |
| #define PBR_SLOT_UV_DETAIL_2 14 |
| #define PBR_SLOT_UV_DETAIL_3 15 |
| #define PBR_SLOT_UV_DETAIL_NORM_0 16 |
| #define PBR_SLOT_UV_DETAIL_NORM_1 17 |
| #define PBR_SLOT_UV_DETAIL_NORM_2 18 |
| #define PBR_SLOT_UV_DETAIL_NORM_3 19 |
| #define PBR_SLOT_UV_DETAIL_WEIGHT 20 |
| #define PBR_SLOT_UV_EMISSIVE 10 |
| #define PBR_SLOT_UV_METAL_ROUGH 8 |
| #define PBR_SLOT_UV_NORMAL 7 |
| #define PBR_SLOT_UV_OCCLUSION 9 |
| #define PBR_SLOT_UV_SPECULAR 11 |
| #define SET_PACKED_SLOT | ( | slot_idx, | |
| x_, | |||
| y_, | |||
| z_, | |||
| w_ | |||
| ) |
| uint64_t build_sampler_flags | ( | material_filter_modes | min_filter, |
| material_filter_modes | mag_filter, | ||
| material_filter_modes | mip_filter, | ||
| material_wrap_modes | wrap_x, | ||
| material_wrap_modes | wrap_y, | ||
| material_wrap_modes | wrap_z | ||
| ) |
Computes the bgfx sampler flag bits that correspond to the requested min/mag/mip filter modes and wrap modes for one texture.
The output is the bitwise-OR of bgfx's BGFX_SAMPLER_* macros, suitable for passing to bgfx::setTexture's flags parameter. Filter modes that match bgfx's defaults (linear filtering, wrap addressing) contribute no bits.
"none" filter is treated as point filter since bgfx doesn't have a true "no filter" concept and point is the closest equivalent.
| min_filter | - The resolved minification filter mode. |
| mag_filter | - The resolved magnification filter mode. |
| mip_filter | - The resolved mip filter mode. |
| wrap_x | - Wrap mode for the U/X texture coordinate. |
| wrap_y | - Wrap mode for the V/Y texture coordinate. |
| wrap_z | - Wrap mode for the W/Z texture coordinate (used by 3D/cube textures). |
Here is the caller graph for this function:| uint64_t compute_sampler_flags_for_texture | ( | material_filter_modes | material_min, |
| material_filter_modes | material_mag, | ||
| material_filter_modes | material_mip, | ||
| material_wrap_modes | wrap_x, | ||
| material_wrap_modes | wrap_y, | ||
| material_wrap_modes | wrap_z, | ||
| bitmap * | bitmap_tag | ||
| ) |
Computes the final bgfx sampler flags for one material texture binding.
Resolves the inherit_from_bitmap and force_*_filtering_mode logic between the material's per-texture sampler settings and the bitmap tag's settings, then maps the resolved filter and wrap modes to bgfx flag bits.
| material_min | - The material's requested minification filter mode. |
| material_mag | - The material's requested magnification filter mode. |
| material_mip | - The material's requested mip filter mode. |
| wrap_x | - Wrap mode for the U/X texture coordinate. |
| wrap_y | - Wrap mode for the V/Y texture coordinate. |
| wrap_z | - Wrap mode for the W/Z texture coordinate. |
| bitmap_tag | - The bitmap being sampled (may be nullptr if not resolved). |
Here is the call graph for this function:| material_filter_modes resolve_mag_filter | ( | material_filter_modes | material_filter, |
| bitmap * | bitmap_tag | ||
| ) |
Resolves the effective magnification filter mode using the same inheritance rules as resolve_min_filter, but consulting the magnification-specific tag fields and force flag.
| material_filter | - The material's per-texture filter mode setting. |
| bitmap | - Pointer to the bitmap tag (or nullptr if no bitmap was found). |
Here is the caller graph for this function:| material_filter_modes resolve_min_filter | ( | material_filter_modes | material_filter, |
| bitmap * | bitmap_tag | ||
| ) |
Resolves the effective minification filter mode by combining the material's requested filter mode with the bitmap tag's filter mode and force flag.
If the bitmap has its force_min_filtering_mode flag set OR the material asks to inherit, the bitmap's filter mode wins. Otherwise the material's choice wins. Used by compute_sampler_flags_for_texture.
| material_filter | - The material's per-texture filter mode setting. |
| bitmap | - Pointer to the bitmap tag (or nullptr if no bitmap was found). |
Here is the caller graph for this function:| material_filter_modes resolve_mip_filter | ( | material_filter_modes | material_filter, |
| bitmap * | bitmap_tag | ||
| ) |
Resolves the effective mip filter mode using the same inheritance rules as resolve_min_filter, but consulting the mip-specific tag fields and force flag.
| material_filter | - The material's per-texture filter mode setting. |
| bitmap | - Pointer to the bitmap tag (or nullptr if no bitmap was found). |
Here is the caller graph for this function: