summaryrefslogtreecommitdiff
path: root/engine/src/rendering.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-08-28 18:32:58 +0200
committerHampusM <hampus@hampusmat.com>2026-08-28 18:32:58 +0200
commitbe94cec078e86e643f52f0f3041a98b36e43ec8b (patch)
tree0e79657d85020e76b0dc3e0586f9dcdacbfcd14e /engine/src/rendering.rs
parentd04bc21ac58a0bd8bcf8fa2fbb87f7b1dd4b140e (diff)
feat(engine): add ability to create textures without imagesHEADmaster
Diffstat (limited to 'engine/src/rendering.rs')
-rw-r--r--engine/src/rendering.rs33
1 files changed, 30 insertions, 3 deletions
diff --git a/engine/src/rendering.rs b/engine/src/rendering.rs
index 5219d0a..cb6ec08 100644
--- a/engine/src/rendering.rs
+++ b/engine/src/rendering.rs
@@ -25,7 +25,7 @@ use crate::rendering::blending::Config as BlendingConfig;
use crate::rendering::object::{Id as ObjectId, Store as ObjectStore};
use crate::rendering::shader::cursor::Binding as ShaderBinding;
use crate::rendering::shader::Program as ShaderProgram;
-use crate::texture::{CubeMapFace, Texture};
+use crate::texture::{CubeMapFace, Properties as TextureProperties};
use crate::vector::Vec2;
use crate::windowing::dpi::PhysicalSize;
use crate::windowing::window::Window;
@@ -77,7 +77,12 @@ impl crate::ecs::extension::Extension for Extension
let _ = collector.add_sole(self.graphics_props);
- collector.add_system(*PRE_RENDER_PHASE, main_render_pass::add_main_render_pass);
+ collector.add_system(
+ *PRE_RENDER_PHASE,
+ main_render_pass::add_main_render_pass
+ .into_system()
+ .initialize(Default::default()),
+ );
collector.add_system(
*RENDER_PHASE,
@@ -215,7 +220,13 @@ pub enum Command
CreateShaderProgram(ObjectId, ShaderProgram),
ActivateShader(ObjectId),
SetShaderBinding(ShaderBinding),
- CreateTexture(ObjectId, AssetOrValue<Texture>),
+ CreateTexture
+ {
+ obj_id: ObjectId,
+ pixel_data_format: TexturePixelDataFormat,
+ creation: TextureCreation,
+ properties: TextureProperties,
+ },
UpdateTexture
{
obj_id: ObjectId,
@@ -401,6 +412,22 @@ bitflags! {
#[derive(Debug, Clone)]
#[non_exhaustive]
+pub enum TextureCreation
+{
+ Texture2D
+ {
+ size: Dimens<u32>,
+ image: Option<Box<[u8]>>,
+ },
+ CubeMap
+ {
+ size: Dimens<u32>,
+ images: Option<[(CubeMapFace, Box<[u8]>); 6]>,
+ },
+}
+
+#[derive(Debug, Clone)]
+#[non_exhaustive]
pub enum TextureUpdate
{
Texture2D