diff options
Diffstat (limited to 'engine/src/rendering.rs')
| -rw-r--r-- | engine/src/rendering.rs | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/engine/src/rendering.rs b/engine/src/rendering.rs index 572f045..7a46b29 100644 --- a/engine/src/rendering.rs +++ b/engine/src/rendering.rs @@ -19,7 +19,6 @@ use crate::ecs::system::initializable::Initializable; use crate::ecs::system::observer::Observe; use crate::ecs::system::Into; use crate::ecs::{declare_entity, pair, Component, Query, Sole}; -use crate::image::Image; use crate::mesh::Mesh; use crate::rendering::blending::Config as BlendingConfig; use crate::rendering::object::{Id as ObjectId, Store as ObjectStore}; @@ -219,12 +218,9 @@ pub enum Command UpdateTexture { obj_id: ObjectId, - image: Image, + pixels: Box<[u8]>, + pixel_data_format: TexturePixelDataFormat, update: TextureUpdate, - - /// Specifies texel index offsets in the x and y directions within the texture - /// pixels. - offset: Vec2<u32>, }, RemoveTexture(ObjectId), CreateMesh @@ -406,9 +402,22 @@ bitflags! { #[non_exhaustive] pub enum TextureUpdate { - Texture2D, + Texture2D + { + size: Dimens<u32>, + + /// Specifies texel index offsets in the x and y directions within the texture + /// pixels. + offset: Vec2<u32>, + }, CubeMap { + size: Dimens<u32>, + + /// Specifies texel index offsets in the x and y directions within the texture + /// pixels. + offset: Vec2<u32>, + face: CubeMapFace, }, } @@ -546,3 +555,41 @@ struct ActiveDrawProperties { pub draw_properties: DrawProperties, } + +#[derive(Debug, Clone, Copy)] +#[non_exhaustive] +pub enum RgbTextureDataType +{ + UnsignedByte, +} + +#[derive(Debug, Clone, Copy)] +#[non_exhaustive] +pub enum RgbaTextureDataType +{ + UnsignedByte, +} + +#[derive(Debug, Clone, Copy)] +#[non_exhaustive] +pub enum SrgbTextureDataType +{ + UnsignedByte, +} + +#[derive(Debug, Clone, Copy)] +#[non_exhaustive] +pub enum SrgbaTextureDataType +{ + UnsignedByte, +} + +#[derive(Debug, Clone, Copy)] +#[non_exhaustive] +pub enum TexturePixelDataFormat +{ + Rgb(RgbTextureDataType), + Rgba(RgbaTextureDataType), + Srgb(SrgbTextureDataType), + Srgba(SrgbaTextureDataType), +} |
