Add an arbitrary texture to structures
This commit is contained in:
+14
-3
@@ -181,7 +181,10 @@ fn main() {
|
||||
|
||||
let mut camera = support::camera::CameraState::new();
|
||||
|
||||
let vertex_buffer = support::load_wavefront(&display, &load_bytes!("../Extensions/LemnosLife/Map/Common/Structures/24.obj"));
|
||||
let vertex_buffer = support::load_wavefront(
|
||||
&display,
|
||||
load_bytes!("../Extensions/LemnosLife/Map/Common/Structures/24.obj"),
|
||||
);
|
||||
|
||||
let structures_program = program!(&display,
|
||||
140 => {
|
||||
@@ -193,8 +196,11 @@ fn main() {
|
||||
|
||||
in vec3 w_position;
|
||||
in vec3 position;
|
||||
in vec2 texture;
|
||||
out vec2 v_texture;
|
||||
|
||||
void main() {
|
||||
v_texture = texture;
|
||||
gl_Position = persp_matrix * view_matrix * vec4(position + w_position, 1.0);
|
||||
}
|
||||
",
|
||||
@@ -202,14 +208,18 @@ fn main() {
|
||||
fragment: "
|
||||
#version 140
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
in vec2 v_texture;
|
||||
out vec4 f_color;
|
||||
|
||||
void main() {
|
||||
f_color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
f_color = texture(tex, v_texture);
|
||||
}
|
||||
",
|
||||
},
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let per_instance = vec![
|
||||
PerInstance {
|
||||
@@ -252,6 +262,7 @@ fn main() {
|
||||
let structures_uniforms = uniform! {
|
||||
persp_matrix: camera.get_perspective(),
|
||||
view_matrix: camera.get_view(),
|
||||
tex: &textures[0],
|
||||
};
|
||||
|
||||
// draw parameters
|
||||
|
||||
Reference in New Issue
Block a user