Skip to main content

ChunkGpu

Struct ChunkGpu 

Source
#[repr(C)]
pub struct ChunkGpu { pub frame_a: [f32; 4], pub frame_b: [f32; 4], pub frame_c: [f32; 4], pub bary0: [f32; 2], pub bary1: [f32; 2], pub bary2: [f32; 2], pub slot: u32, pub level: u32, pub res: u32, pub _pad: [u32; 3], }
Expand description

One chunk’s GPU descriptor (std430, 96 bytes).

Field order is the shader’s layout contract — do not reorder without updating ChunkRealize.slang. Every array member is [f32;4] or smaller, and the struct is padded to a 16-byte multiple so that an array of ChunkGpu has the correct std430 stride (the shader indexes chunks[i] directly).

Fields§

§frame_a: [f32; 4]

Face frame corner A (xyz) and sphere radius (w); radius=0 → flat terrain.

§frame_b: [f32; 4]

Face frame corner B (xyz), w=0 (unused).

§frame_c: [f32; 4]

Face frame corner C (xyz), w=0 (unused).

§bary0: [f32; 2]

Barycentric coords of chunk corner 0: (wb, wc); wa = 1 − wb − wc.

§bary1: [f32; 2]

Barycentric coords of chunk corner 1.

§bary2: [f32; 2]

Barycentric coords of chunk corner 2.

§slot: u32

Vertex-pool slot: this chunk owns verts_per_chunk(res) contiguous vertices starting at slot * verts_per_chunk(res) in the pool texture.

§level: u32

LOD level (== quadtree depth from the icosphere face root).

§res: u32

Edge resolution: each chunk edge has res segments; vertex count = verts_per_chunk(res).

§_pad: [u32; 3]

Explicit std430 padding: rounds the struct from 84 → 96 bytes so that size_of::<ChunkGpu>() % 16 == 0 (required by the std430 array-stride rule).

Implementations§

Source§

impl ChunkGpu

Source

pub fn from_chunk(frame: &FaceFrame, c: &Chunk, slot: u32, res: u32) -> Self

Pack one chunk into its GPU descriptor.

frame is the icosphere face that owns this chunk; slot is the chunk’s assigned vertex-pool slot.

Trait Implementations§

Source§

impl Clone for ChunkGpu

Source§

fn clone(&self) -> ChunkGpu

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChunkGpu

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ChunkGpu

Source§

fn eq(&self, other: &ChunkGpu) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Zeroable for ChunkGpu

§

fn zeroed() -> Self

Source§

impl Copy for ChunkGpu

Source§

impl Pod for ChunkGpu

Source§

impl StructuralPartialEq for ChunkGpu

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> AnyBitPattern for T
where T: Pod,

§

impl<T> NoUninit for T
where T: Pod,