Struct Texture
Defined in File texture.h
Inheritance Relationships
Base Type
public CE::Rendering::Resources::Image(Struct Image)
Struct Documentation
-
struct Texture : public CE::Rendering::Resources::Image
Declaration:
finalImmutable uploaded 2D texture; public dimensions describe the upload and must not be edited to simulate resizing.
RGBA input rows are top-to-bottom and flipped during upload; red alpha atlases keep the font baker’s row order and sample as white RGB with supplied alpha. Retained Handle retirement performs no native calls from destructors.
See also
Public Functions
Decode RGBA pixels and upload them in the supplied live native domain.
- Parameters:
lifetime – Required active owner/current-context lifetime.
file – Nonnull NUL-terminated file path, borrowed through decoding.
use_mipmaps – Generate the complete mip chain after uploading the base image.
pixelate – Select nearest min/magnification and disable anisotropy; false selects linear filtering and available maximum anisotropy.
wrap_opt – Valid native wrap token applied to both axes. Decode/native/allocation failures propagate and adopted names retire normally. Upload uses and then unbinds texture unit 0; no cache entry is published.
Copy raw pixels into immutable native storage on its live owner/current context.
- Parameters:
lifetime – Required active native domain.
bitmap_data – Nonnull contiguous pixel bytes borrowed until return; caller supplies a complete addressable array.
width – Positive pixel width.
height – Positive pixel height.
use_mipmaps – Generate mip levels; a 1 by 1 base image is already complete.
pixelate – Nearest filtering without anisotropy when true.
wrap_opt – Valid native wrap token for both axes.
fmt – Red for one-byte alpha in baked row order, RGBA for top-to-bottom four-byte color. Malformed dimensions/null data throw invalid_args; native/allocation failures propagate. Unit 0 is used then unbound; caller pixels are not retained.
-
inline virtual CE::Rendering::Geometry::PixelSize pixel_size() const override
Declaration:
[[nodiscard]]- Returns:
Copied public dimensions as nonnegative pixel sizes, without native calls. This reads metadata, not live native storage.
-
virtual void bind(std::uint32_t unit) const override
Select the validated unit, bind this texture and clear any sampler-object override there.
- Parameters:
unit – Zero-based supported unit. Requires live owner/current context. Default texture sampling applies until a separate Sampler is bound; no material/program is selected.
-
void require_binding(std::uint32_t unit) const
Validate live owner/current context and unit limit without changing bindings.
- Parameters:
unit – Zero-based unit below the construction-context limit. Invalid units throw invalid_args; inactive/foreign/noncurrent lifetime throws failed_operation.
-
inline bool has_complete_mipmaps() const noexcept
Declaration:
[[nodiscard]]- Returns:
Whether upload generated the full chain or the base image was 1 by 1; CPU metadata inspection only.
-
inline const ResourceLifetime *resource_domain() const noexcept
Declaration:
[[nodiscard]]- Returns:
Borrowed identity of the retained native lifetime; identity does not check current/active state.
-
void unbind(std::uint32_t unit) const
Select the validated unit and unbind both its texture and sampler object.
- Parameters:
unit – Zero-based supported unit. Requires this texture’s live owner/current context; does not destroy the image or restore prior native bindings.