clarify vertex indices
This commit is contained in:
1 parent
d4bfdce8c4
commit
0170d1623a
2 files changed
+12
-11
No files matched your search
@@ -4,10 +4,10 @@ use ::window::*;
|
||||
/// Each cell is composed of two triangles built from 4 vertices.
|
||||
/// The buffer is organized row by row.
|
||||
pub const VERTICES_PER_CELL: usize = 4;
|
||||
const V_TOP_LEFT: usize = 0;
|
||||
const V_TOP_RIGHT: usize = 1;
|
||||
const V_BOT_LEFT: usize = 2;
|
||||
const V_BOT_RIGHT: usize = 3;
|
||||
pub const V_TOP_LEFT: usize = 0;
|
||||
pub const V_TOP_RIGHT: usize = 1;
|
||||
pub const V_BOT_LEFT: usize = 2;
|
||||
pub const V_BOT_RIGHT: usize = 3;
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
pub struct Vertex {
|
||||
|
||||
@@ -11,7 +11,7 @@ use failure::Fallible;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use super::quad::Vertex;
|
||||
use super::quad::*;
|
||||
|
||||
pub struct SoftwareRenderState {
|
||||
pub glyph_cache: RefCell<GlyphCache<ImageTexture>>,
|
||||
@@ -168,12 +168,13 @@ impl OpenGLRenderState {
|
||||
});
|
||||
|
||||
// Emit two triangles to form the glyph quad
|
||||
indices.push(idx);
|
||||
indices.push(idx + 1);
|
||||
indices.push(idx + 2);
|
||||
indices.push(idx + 1);
|
||||
indices.push(idx + 2);
|
||||
indices.push(idx + 3);
|
||||
indices.push(idx + V_TOP_LEFT as u32);
|
||||
indices.push(idx + V_TOP_RIGHT as u32);
|
||||
indices.push(idx + V_BOT_LEFT as u32);
|
||||
|
||||
indices.push(idx + V_TOP_RIGHT as u32);
|
||||
indices.push(idx + V_BOT_LEFT as u32);
|
||||
indices.push(idx + V_BOT_RIGHT as u32);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user