-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ren.quad] very basic quad rendering now has proof-of-concept
- Loading branch information
Showing
4 changed files
with
43 additions
and
5 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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
shader(type = fragment); | ||
|
||
output(id = 0) vec4 colour; | ||
|
||
void main() | ||
{ | ||
|
||
colour = vec4(1.0f, 0.0f, 1.0f, 1.0f); | ||
} |
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 |
---|---|---|
@@ -1,6 +1,32 @@ | ||
shader(type = vertex); | ||
|
||
struct quad_data | ||
{ | ||
vec4 pos_scale; | ||
}; | ||
|
||
resource(id = 0) const buffer quad | ||
{ | ||
quad_data data[]; | ||
}; | ||
|
||
vec2 quad_positions[6] = vec2[]( | ||
vec2(1.0, -1.0), vec2(1.0, 1.0), vec2(-1.0, -1.0), | ||
vec2(1.0, 1.0), vec2(-1.0, 1.0), vec2(-1.0, -1.0) | ||
); | ||
|
||
vec2 quad_texcoords[6] = vec2[]( | ||
vec2(1.0, 1.0), vec2(1.0, 0.0), vec2(0.0, 1.0), | ||
vec2(1.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 1.0) | ||
); | ||
|
||
void main() | ||
{ | ||
|
||
const uint quad_id = in::vertex_id / 6; | ||
vec2 local_pos = quad_positions[in::vertex_id % 6]; | ||
quad_data cur_quad = quad.data[quad_id]; | ||
|
||
vec2 position_worldspace = cur_quad.pos_scale.xy + (local_pos * cur_quad.pos_scale.zw); | ||
|
||
out::position = vec4(position_worldspace, 0, 1); | ||
} |
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