Added assets
This commit is contained in:
parent
180ac6b7cb
commit
037b38c704
|
@ -0,0 +1,22 @@
|
|||
varying vec3 fNormal;
|
||||
varying vec4 fFrontColor;
|
||||
|
||||
vec3 ambientLight = vec3(0.2,0.2,0.2);
|
||||
vec3 directionnalLight = normalize(vec3(10,5,7));
|
||||
vec3 directionnalLightFactor = vec3(0.5,0.5,0.5);
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
void main() {
|
||||
|
||||
vec3 ambientFactor = ambientLight;
|
||||
vec3 lambertFactor = max(vec3(0.0,0.0,0.0), dot(directionnalLight, fNormal) * directionnalLightFactor);
|
||||
vec4 noTexColor = vec4(ambientFactor + lambertFactor, 1.0);
|
||||
|
||||
vec4 color = texture2D(tex, gl_TexCoord[0].st);
|
||||
|
||||
vec4 fragColor = noTexColor * color;
|
||||
gl_FragColor = fragColor * fFrontColor;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
varying vec3 fNormal;
|
||||
varying vec4 fTexCoord;
|
||||
varying vec4 fFrontColor;
|
||||
|
||||
void main() {
|
||||
|
||||
fNormal = gl_Normal;
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
fFrontColor = gl_Color;
|
||||
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
extern crate num;
|
||||
|
||||
#[macro_use]
|
||||
extern crate verbose_log;
|
||||
#[macro_use] extern crate verbose_log;
|
||||
#[macro_use] extern crate glium;
|
||||
|
||||
pub mod math;
|
||||
pub mod model;
|
||||
pub mod renderer;
|
||||
pub mod parser;
|
||||
pub mod exporter;
|
||||
|
|
|
@ -245,6 +245,13 @@ impl Vector3<f64> {
|
|||
}
|
||||
}
|
||||
|
||||
type Vector2f32 = Vector2<f32>; implement_vertex!(Vector2f32, data);
|
||||
type Vector2f64 = Vector2<f64>; implement_vertex!(Vector2f64, data);
|
||||
type Vector3f32 = Vector3<f32>; implement_vertex!(Vector3f32, data);
|
||||
type Vector3f64 = Vector3<f64>; implement_vertex!(Vector3f64, data);
|
||||
type Vector4f32 = Vector4<f32>; implement_vertex!(Vector4f32, data);
|
||||
type Vector4f64 = Vector4<f64>; implement_vertex!(Vector4f64, data);
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
||||
|
|
|
@ -19,6 +19,13 @@ fn main() {
|
|||
let context = ContextBuilder::new();
|
||||
let display = Display::new(window, context, &events_loop).unwrap();
|
||||
|
||||
let program = glium::Program::from_source(
|
||||
&display,
|
||||
include_str!("../../assets/shaders/shader.vert"),
|
||||
include_str!("../../assets/shaders/shader.frag"),
|
||||
None
|
||||
).unwrap();
|
||||
|
||||
let mut closed = false;
|
||||
|
||||
while !closed {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
pub struct Renderer;
|
Loading…
Reference in New Issue