Skip to main content

Topology

Enum Topology 

Source
pub enum Topology {
    PointList,
    LineList,
    LineStrip,
    TriangleList,
    TriangleStrip,
    LineListAdjacency,
    LineStripAdjacency,
    TriangleListAdjacency,
    TriangleStripAdjacency,
}
Expand description

How a draw’s vertices make primitives (D3D’s primitive topologies a geometry shader can follow).

Variants§

§

PointList

Each vertex is a point.

§

LineList

Every two vertices make a line.

§

LineStrip

Each vertex after the first makes a line with the one before it.

§

TriangleList

Every three vertices make a triangle.

§

TriangleStrip

Each vertex after the second makes a triangle with the two before it (odd triangles swap their last two vertices).

§

LineListAdjacency

Every four vertices make a line with its two neighbours.

§

LineStripAdjacency

A strip of lines with an adjacent vertex at each end.

§

TriangleListAdjacency

Every six vertices make a triangle with its three neighbours.

§

TriangleStripAdjacency

A strip of triangles with adjacency, numbered as D3D11 numbers them.

Implementations§

Source§

impl Topology

Source

pub fn input(self) -> GsInput

The primitive a geometry program reads to be drawn with this topology.

Source

pub fn primitives(self, vertices: usize) -> Vec<Vec<usize>>

The primitives of a draw of vertices vertices, each as the indices of its vertices in the order the geometry program reads them (GsInput::vertices of them). Vertices that complete no primitive are ignored.

  • A strip’s primitive i is [i, i + 1, ...], a triangle strip’s odd primitive [i, i + 2, i + 1] (its last two swapped).
  • A line with adjacency is [before, start, end, after].
  • A triangle with adjacency is [a, adjacent to a-b, b, adjacent to b-c, c, adjacent to c-a].
  • A triangle strip with adjacency is the vertices 0, 2, 4, ... of a triangle strip, and between them the vertices that are adjacent to its edges (an odd vertex 2i + 1 the first’s 0-2 edge): for n = (vertices - 4) / 2 primitives, primitive i (even) is [2i, 2i - 2 (1 for i = 0), 2i + 2, 2i + 6, 2i + 4, 2i + 3] and primitive i (odd) [2i, 2i + 3, 2i + 4, 2i + 6, 2i + 2, 2i - 2], the vertex 2i + 6 that the last primitive does not have replaced by 2i + 5.

Trait Implementations§

Source§

impl Clone for Topology

Source§

fn clone(&self) -> Self

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 Copy for Topology

Source§

impl Debug for Topology

Source§

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

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

impl Eq for Topology

Source§

impl From<GsOutput> for Topology

Source§

fn from(output: GsOutput) -> Self

The topology of the strips a program’s output makes.

Source§

impl PartialEq for Topology

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Topology

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
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.