-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further sketching out of the interface between renderer and simulation …
- Loading branch information
Showing
7 changed files
with
157 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// a simple car | ||
// | ||
// . B-------------C | ||
// 3-------------4 ` \ 1.65 | ||
// / 9-A \ . D-------E | | ||
// 1-2 | 5-------6 ` | Z | ||
// | . 8- - - - - - - - - - -|------F | Y . 0.9 | ||
// 0----------------------------7 ` 0 -0.9 | ||
// | ||
// -2.25-----------X----------2.25 | ||
|
||
extern crate monet; | ||
|
||
use monet::Vertex; | ||
|
||
pub fn create() -> monet::Thing { | ||
monet::Thing::new( | ||
vec![ | ||
Vertex { position: [ -2.25, -0.9, 0.00 ] }, // 0 | ||
Vertex { position: [ -2.25, -0.9, 0.80 ] }, // 1 | ||
Vertex { position: [ -2.00, -0.9, 1.00 ] }, // 2 | ||
Vertex { position: [ -1.75, -0.9, 1.65 ] }, // 3 | ||
Vertex { position: [ 0.30, -0.9, 1.65 ] }, // 4 | ||
Vertex { position: [ 1.00, -0.9, 1.00 ] }, // 5 | ||
Vertex { position: [ 2.25, -0.9, 0.80 ] }, // 6 | ||
Vertex { position: [ 2.25, -0.9, 0.00 ] }, // 7 | ||
|
||
Vertex { position: [ -2.25, 0.9, 0.00 ] }, // 8 | ||
Vertex { position: [ -2.25, 0.9, 0.80 ] }, // 9 | ||
Vertex { position: [ -2.00, 0.9, 1.00 ] }, // A | ||
Vertex { position: [ -1.75, 0.9, 1.65 ] }, // B | ||
Vertex { position: [ 0.30, 0.9, 1.65 ] }, // C | ||
Vertex { position: [ 1.00, 0.9, 1.00 ] }, // D | ||
Vertex { position: [ 2.25, 0.9, 0.80 ] }, // E | ||
Vertex { position: [ 2.25, 0.9, 0.00 ] }, // F | ||
], | ||
vec![ | ||
// right side | ||
0, 1, 2, | ||
0, 2, 5, | ||
0, 5, 7, | ||
5, 6, 7, | ||
2, 3, 4, | ||
2, 4, 5, | ||
// left side | ||
8, 9, 0xA, | ||
8, 0xA, 0xD, | ||
8, 0xD, 0xF, | ||
0xD, 0xE, 0xF, | ||
0xA, 0xB, 0xC, | ||
0xA, 0xC, 0xD, | ||
// connection between sides (front to back) | ||
8, 9, 1, | ||
8, 1, 0, | ||
9, 0xA, 2, | ||
9, 2, 1, | ||
0xA, 0xB, 3, | ||
0xA, 3, 2, | ||
0xB, 0xC, 4, | ||
0xB, 4, 3, | ||
0xC, 0xD, 5, | ||
0xC, 5, 4, | ||
0xD, 0xE, 6, | ||
0xD, 6, 5, | ||
0xE, 0xF, 7, | ||
0xE, 7, 6u16 | ||
] | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#version 140 | ||
out vec4 f_color; | ||
in vec3 p; | ||
void main() { | ||
f_color = vec4(1.0, p.x, p.y, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#version 140 | ||
uniform mat4 model; | ||
uniform mat4 view; | ||
uniform mat4 perspective; | ||
in vec3 position; | ||
out vec3 p; | ||
void main() { | ||
mat4 modelview = view * model; | ||
gl_Position = perspective * modelview * vec4(position, 1.0); | ||
p = position; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.