1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
pub use self::{
camera::Camera,
manager::GraphicsManager,
mesh::{Mesh, MeshBuilder},
shaders::{Program, Shader},
sprites::{Sprite, SpriteSheet},
};
use gl;
use maths::Vector2u;
use std::cmp::Ordering;
mod batches;
mod camera;
mod manager;
mod mesh;
mod shaders;
mod sprites;
pub type TextureID = gl::types::GLuint;
pub type ProgramID = gl::types::GLuint;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Texture {
id: TextureID,
size: Vector2u,
}
impl PartialOrd for Texture {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Texture {
fn cmp(&self, other: &Self) -> Ordering {
self.id.cmp(&other.id)
}
}
impl Texture {
pub fn id(&self) -> TextureID {
self.id
}
pub fn size(&self) -> Vector2u {
self.size
}
pub fn width(&self) -> u32 {
self.size.x
}
pub fn height(&self) -> u32 {
self.size.y
}
}