forked from TheJJ/openage
-
Notifications
You must be signed in to change notification settings - Fork 1
New batch renderer #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
surajhanchinal
wants to merge
96
commits into
Vtec234:new-renderer
Choose a base branch
from
surajhanchinal:new-renderer
base: new-renderer
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
ec56851
buildsystem: inotify package search name lowercased
TheJJ 47023b7
buildsystem: implemented vulkan cmake module
TheJJ fa04522
buildsystem: integrated vulkan and opengl detection
TheJJ 6c228e7
renderer: modular render window and context creation
TheJJ d1d59c0
renderer: legacy opengl square rendering
TheJJ 6454fc8
renderer: initial generic texture implementation
TheJJ 418838f
renderer: rendering quad with opengl 3.3
TheJJ 8e170d7
renderer: texture and shader creation abstractions
TheJJ ed60e49
renderer: use the full framebuffer for the test quad
TheJJ 0902c83
renderer: implemented loading shaders from file
TheJJ 9509f1b
renderer: initially integrated into the engine
TheJJ fdb85f6
renderer: renamed pipeline Program to RawProgram
TheJJ 629a86e
renderer: moved program api contents to separate files
TheJJ c53f4cd
renderer: initial pipeline variable abstraction
TheJJ 594544f
renderer: demo id selection via cython
TheJJ 3094067
renderer: first successful texture draw
TheJJ a16d989
renderer: basic uniform variable abstraction
TheJJ b1b62b4
renderer: implemented vertex attribute packing and uploading
TheJJ c903e31
renderer: drawing texture with pipeline abstraction
TheJJ 6b4eaa7
renderer: made error checking context-dependent
TheJJ 23f2f3f
renderer: only upload gpu buffer when changed.
TheJJ 0c1ef26
renderer: towards render tasks by storing uniform state
TheJJ 7170d60
renderer: opengl version checking
Vtec234 d48a9de
engine: adjust new upstream changes to renderer branch changes
Vtec234 4f7993b
renderer: resource loading refactor
Vtec234 a36d4d5
renderer: begin major refactor
Vtec234 9354698
engine: revert changes
Vtec234 77cb221
renderer: first working version
Vtec234 05b3991
renderer: documentation and progress
Vtec234 c2dc925
renderer: screenshots
Vtec234 e352ab5
renderer: fix glsl parsing
Vtec234 182065c
renderer: documentation and small interface changes
Vtec234 d920560
First work on pixel-perfect hitbox, minor changes
citron0xa9 bd6bcc5
Working optional id write also dependent on alpha value. A bit hacky
citron0xa9 0cd4208
renderer: add row alignment support for textures; add support for rea…
Vtec234 1085d12
Extracting id from pixel value improved, added missing glPixelStorei
citron0xa9 71a679e
Simplified id drawing, using 32 bit ids now
citron0xa9 f74561a
WIP: Using VBO's and VAO's for drawing, matrix transformations tests
citron0xa9 e43f521
Enabled depth testing (added depth texture to FBO)
citron0xa9 625476c
renderer: small shader fix to avoid invalid uniforms
Vtec234 9d9d156
renderer: add more uniform types
Vtec234 197c2b9
renderer: add MeshData, move quad geometry there; make classes final;…
Vtec234 113388d
renderer: misc fixes and removals
Vtec234 38bd3ee
renderer: add support for meshed geometry
Vtec234 1b178ac
renderer: delete old files
Vtec234 b0fa07f
renderer: shader improvements, uniform and attribute parsing
Vtec234 eabebbb
add self to mailmap
Vtec234 4037e62
renderer: fix IDs and add more textures support
Vtec234 5a9d6be
renderer: fix build
Vtec234 1593ff2
renderer: add headers without implementations to CMakeLists to make Q…
Vtec234 76ca26f
renderer: refactor
Vtec234 d52cc0b
renderer: fix compiler errors after rebase
Vtec234 086a23a
renderer: terrain prototype
citron0xa9 23650fc
renderer: initial Vulkan framework
Vtec234 aadf4f8
renderer: Draw Gaben
Vtec234 ec9da33
renderer: screenshot support and refactor window
Vtec234 69fc6ea
renderer: support for Ubuntu 16
Vtec234 f46b20c
Update texture_data.cpp
surajhanchinal d112557
Update mesh_data.h
surajhanchinal 5af236c
Update tests.cpp
surajhanchinal c45a488
Update mesh_data.cpp
surajhanchinal b60aa2d
Update tests.cpp
surajhanchinal 799e250
New files for testing new features
surajhanchinal 7766c7a
adding new classes for modular rendering
surajhanchinal 7d8b5b8
first commit
surajhanchinal 8baede0
texture manager v1
surajhanchinal a28e801
TextureManager v3
surajhanchinal 292dc99
Delete test_before_lot_of_messing.cpp
surajhanchinal 642826b
Delete test_fail.cpp
surajhanchinal f2a8f06
Delete temp_comm.cpp
surajhanchinal d7f06ce
Delete suraj.cpp
surajhanchinal bede635
Delete sprite2.cpp
surajhanchinal 8ad62a9
Delete sprite2.h
surajhanchinal 2c2fd97
remove unnecessary files
surajhanchinal f80b9c4
ignore textures and copyrighted assets
surajhanchinal 8a956be
update gitignore
surajhanchinal e4dcead
removing unnecessary files
surajhanchinal 6e0aceb
commit
surajhanchinal dbfcd7d
texture manager terrain v1
surajhanchinal c872a00
stress test
surajhanchinal 0413486
RVO integration
surajhanchinal b98f9cc
testing phase
surajhanchinal 5ded02c
vertexrenderer
surajhanchinal be12b51
Testing the renderer
surajhanchinal 2b2ad9e
added texture array support
surajhanchinal f957e81
removing RVO library and adding TerrainManager class
surajhanchinal 8083d1a
adding TerrainManager Class
surajhanchinal 615046e
added more abstraction to TerrainManager
surajhanchinal 6a83f98
removed test class
surajhanchinal 5f3d773
removed .vscode from version control
surajhanchinal 31dd5ff
properly removed .vscode folder
surajhanchinal 69f17a7
removed unused perspective.h
surajhanchinal 5c3aa4d
removing unused libraries
surajhanchinal 54eb090
better fps counter
surajhanchinal b2e6b09
testing mulitple renderables
surajhanchinal 0627ecc
some more tests with renderable
surajhanchinal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -61,3 +61,7 @@ perf.data* | |
| /GPATH | ||
| /GRTAGS | ||
| /GTAGS | ||
| #copyrighted assets | ||
| /assets/converted/ | ||
| /assets/terrain/ | ||
| .vscode/settings.json | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,34 @@ | ||
| // alpha masking shader | ||
| // | ||
| // applies an alpha mask texture to a base texture, | ||
| // then draws the masked texture. | ||
| #version 330 | ||
|
|
||
| // the base and mask texture, base is the plain terrain tile | ||
| uniform sampler2D base_texture; | ||
| uniform sampler2D mask_texture; | ||
|
|
||
| // disable blending and show the mask instead | ||
| //uniform bool show_mask; | ||
|
|
||
| // get those interpolated texture position from vertexshader | ||
| in vec2 base_tex_position; | ||
| in vec2 mask_tex_position; | ||
|
|
||
| layout(location=0) out vec4 blended_pixel; | ||
|
|
||
| void main() { | ||
| // get the texel from the uniform texture. | ||
| vec4 base_pixel = texture2D(base_texture, base_tex_position); | ||
| vec4 mask_pixel = texture2D(mask_texture, mask_tex_position); | ||
|
|
||
| //float factor = 1.0 - mask_pixel.x; | ||
| float factor = mask_pixel.x; | ||
| vec4 blended_pixel = vec4(base_pixel.r, base_pixel.g, base_pixel.b, base_pixel.a - factor); | ||
|
|
||
| //if (0) { | ||
| // gl_FragColor = mask_pixel; | ||
| //} else { | ||
| gl_FragColor = blended_pixel; | ||
| //} | ||
| } |
This file contains hidden or 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,25 @@ | ||
| // vertex shader for applying an alpha mask to a texture | ||
| #version 330 | ||
|
|
||
| // modelview*projection matrix | ||
| uniform mat4 mvp_matrix; | ||
|
|
||
| // the position of this vertex | ||
| layout(location=0) in vec2 vertex_position; | ||
|
|
||
| // send the texture coordinates to the fragmentshader | ||
| layout(location=1) in vec2 base_tex_coordinates; | ||
| layout(location=2) in vec2 mask_tex_coordinates; | ||
|
|
||
| // send the texture coordinates to the fragmentshader | ||
| out vec2 base_tex_position; | ||
| out vec2 mask_tex_position; | ||
|
|
||
| void main(void) { | ||
| // transform the position with the mvp matrix | ||
| gl_Position = mvp_matrix * vec4(vertex_position,0.0,1.0); | ||
|
|
||
| // set the fixpoints for the tex coordinates at this vertex | ||
| mask_tex_position = mask_tex_coordinates; | ||
| base_tex_position = base_tex_coordinates; | ||
| } |
This file contains hidden or 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,157 @@ | ||
| #version 330 core | ||
| out vec4 FragColor; | ||
|
|
||
| in vec4 ourColor; | ||
| in vec2 pos; | ||
| in vec2 uv; | ||
| in float a_id; | ||
| uniform vec2 mouse_pos = vec2(0.0,0.0); | ||
|
|
||
| uniform sampler2D texture_0; | ||
| uniform sampler2D texture_1; | ||
| uniform sampler2D texture_2; | ||
| uniform sampler2D texture_3; | ||
| uniform sampler2D texture_4; | ||
| uniform sampler2D texture_5; | ||
| uniform sampler2D texture_6; | ||
| uniform sampler2D texture_7; | ||
| uniform sampler2D texture_8; | ||
| uniform sampler2D texture_9; | ||
| uniform sampler2D texture_10; | ||
| uniform sampler2D texture_11; | ||
| uniform sampler2D texture_12; | ||
| uniform sampler2D texture_13; | ||
| uniform sampler2D texture_14; | ||
| uniform sampler2D texture_15; | ||
| uniform sampler2D texture_16; | ||
| uniform sampler2D texture_17; | ||
| uniform sampler2D texture_18; | ||
| uniform sampler2D texture_19; | ||
| uniform sampler2D texture_20; | ||
| uniform sampler2D texture_21; | ||
| uniform sampler2D texture_22; | ||
| uniform sampler2D texture_23; | ||
| uniform sampler2D texture_24; | ||
| uniform sampler2D texture_25; | ||
| uniform sampler2D texture_26; | ||
| uniform sampler2D texture_27; | ||
| uniform sampler2D texture_28; | ||
| uniform sampler2D texture_29; | ||
| uniform sampler2D texture_30; | ||
| uniform sampler2D texture_31; | ||
|
|
||
| void switcher(in int index,out vec4 color){ | ||
|
|
||
| switch(index){ | ||
| case 0: | ||
| color = texture(texture_0, uv); | ||
| break; | ||
| case 1: | ||
| color = texture(texture_1, uv); | ||
| break; | ||
| case 2: | ||
| color = texture(texture_2, uv); | ||
| break; | ||
| case 3: | ||
| color = texture(texture_3, uv); | ||
| break; | ||
| case 4: | ||
| color = texture(texture_4, uv); | ||
| break; | ||
| case 5: | ||
| color = texture(texture_5, uv); | ||
| break; | ||
| case 6: | ||
| color = texture(texture_6, uv); | ||
| break; | ||
| case 7: | ||
| color = texture(texture_7, uv); | ||
| break; | ||
| case 8: | ||
| color = texture(texture_8, uv); | ||
| break; | ||
| case 9: | ||
| color = texture(texture_9, uv); | ||
| break; | ||
| case 10: | ||
| color = texture(texture_10, uv); | ||
| break; | ||
| case 11: | ||
| color = texture(texture_11, uv); | ||
| break; | ||
| case 12: | ||
| color = texture(texture_12, uv); | ||
| break; | ||
| case 13: | ||
| color = texture(texture_13, uv); | ||
| break; | ||
| case 14: | ||
| color = texture(texture_14, uv); | ||
| break; | ||
| case 15: | ||
| color = texture(texture_15, uv); | ||
| break; | ||
| case 16: | ||
| color = texture(texture_16, uv); | ||
| break; | ||
| case 17: | ||
| color = texture(texture_17, uv); | ||
| break; | ||
| case 18: | ||
| color = texture(texture_18, uv); | ||
| break; | ||
| case 19: | ||
| color = texture(texture_19, uv); | ||
| break; | ||
| case 20: | ||
| color = texture(texture_20, uv); | ||
| break; | ||
| case 21: | ||
| color = texture(texture_21, uv); | ||
| break; | ||
| case 22: | ||
| color = texture(texture_22, uv); | ||
| break; | ||
| case 23: | ||
| color = texture(texture_23, uv); | ||
| break; | ||
| case 24: | ||
| color = texture(texture_24, uv); | ||
| break; | ||
| case 25: | ||
| color = texture(texture_25, uv); | ||
| break; | ||
| case 26: | ||
| color = texture(texture_26, uv); | ||
| break; | ||
| case 27: | ||
| color = texture(texture_27, uv); | ||
| break; | ||
| case 28: | ||
| color = texture(texture_28, uv); | ||
| break; | ||
|
|
||
| case 29: | ||
| color = texture(texture_29, uv); | ||
| break; | ||
| case 30: | ||
| color = texture(texture_30, uv); | ||
| break; | ||
|
|
||
| case 31: | ||
| color = texture(texture_31, uv); | ||
| break; | ||
| } | ||
| } | ||
| void main() | ||
| { | ||
| float intensity = 500.0/(length(pos - mouse_pos)); | ||
| FragColor = ourColor*intensity; | ||
| if(a_id != -1.0){ | ||
| int index = int(a_id + 0.5); | ||
| vec4 tex_color; | ||
| switcher(index,tex_color); | ||
| FragColor = tex_color;//*intensity; | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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,27 @@ | ||
| #version 330 core | ||
| layout (location = 0) in vec2 aPos; | ||
| layout (location = 1) in vec4 aColor; | ||
| layout (location = 2) in vec2 auv; | ||
| layout (location = 3) in float active_id; | ||
| layout (location = 4) in float is_terrain; | ||
| uniform mat4 ortho = mat4(1.0); | ||
| uniform mat4 dimet = mat4(1.0); | ||
| out vec4 ourColor; | ||
| out vec2 pos; | ||
| out vec2 uv; | ||
| out float a_id; | ||
|
|
||
|
|
||
|
|
||
| void main() | ||
| { | ||
| if(is_terrain == 1.0){ | ||
| gl_Position = ortho*dimet*vec4(aPos,0.0, 1.0); | ||
| } | ||
| else | ||
| gl_Position = ortho*vec4(aPos,0.0, 1.0); | ||
| ourColor = aColor; | ||
| pos =aPos; | ||
| uv = auv; | ||
| a_id = active_id; | ||
| } |
This file contains hidden or 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,10 @@ | ||
| #version 330 | ||
|
|
||
| uniform sampler2D color_texture; | ||
|
|
||
| in vec2 v_uv; | ||
| out vec4 col; | ||
|
|
||
| void main() { | ||
| col = texture(color_texture, v_uv); | ||
| } |
This file contains hidden or 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,17 @@ | ||
| #version 330 | ||
|
|
||
| in vec2 v_uv; | ||
| uniform sampler2D tex; | ||
| uniform uint u_id; | ||
|
|
||
| layout(location=0) out vec4 col; | ||
| layout(location=1) out uint id; | ||
|
|
||
| void main() { | ||
| vec4 tex_val = texture(tex, v_uv); | ||
| if (tex_val.a == 0) { | ||
| discard; | ||
| } | ||
| col = tex_val; | ||
| id = u_id + 1u; | ||
| } |
This file contains hidden or 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,15 @@ | ||
| #version 330 core | ||
| out vec4 FragColor; | ||
|
|
||
| in vec4 ourColor; | ||
| in vec2 pos; | ||
| in vec2 auv; | ||
| uniform sampler2DArray texture_array; | ||
| uniform int layer = 0; | ||
| //uniform sampler2D texture_array; | ||
| void main() | ||
| { | ||
| //float intensity = 100.0/(length(pos - mouse_pos)); | ||
| //FragColor = ourColor;//*intensity; | ||
| FragColor = texture(texture_array,vec3(auv,layer)); | ||
| } |
This file contains hidden or 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,21 @@ | ||
| #version 330 core | ||
| layout (location = 0) in vec2 aPos; | ||
| layout (location = 1) in vec4 aColor; | ||
| layout (location = 2) in vec2 uv; | ||
| uniform mat4 ortho = mat4(1.0); | ||
| uniform mat4 dimet = mat4(1.0); | ||
| /*mat4 ortho = mat4(2.0/1920.0,0.0,0.0,-1.0, | ||
| 0.0,-2.0/1080.0,0.0,1.0, | ||
| 0.0,0.0,1.0,0.0, | ||
| 0.0,0.0,1.0,1.0); | ||
| */ | ||
| out vec4 ourColor; | ||
| out vec2 pos; | ||
| out vec2 auv; | ||
| void main() | ||
| { | ||
| gl_Position = ortho*dimet*vec4(aPos,0.0, 1.0); | ||
| ourColor = aColor; | ||
| pos =aPos; | ||
| auv = uv; | ||
| } |
This file contains hidden or 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 330 core | ||
| out vec4 FragColor; | ||
|
|
||
| in vec2 pos; | ||
| in vec2 auv; | ||
| in float tex_ind; | ||
| uniform sampler2DArray texture_array; | ||
| void main() | ||
| { | ||
| FragColor = texture(texture_array,vec3(auv,tex_ind)); | ||
| } |
This file contains hidden or 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,23 @@ | ||
| #version 330 core | ||
| layout (location = 0) in vec2 aPos; | ||
| layout (location = 1) in vec2 uv; | ||
| layout (location = 2) in float terrain_index; | ||
| layout (location = 3) in float alpha_mask; | ||
|
|
||
| uniform mat4 ortho = mat4(1.0); | ||
| uniform mat4 dimet = mat4(1.0); | ||
| /*mat4 ortho = mat4(2.0/1920.0,0.0,0.0,-1.0, | ||
| 0.0,-2.0/1080.0,0.0,1.0, | ||
| 0.0,0.0,1.0,0.0, | ||
| 0.0,0.0,1.0,1.0); | ||
| */ | ||
| out vec2 pos; | ||
| out vec2 auv; | ||
| out float tex_ind; | ||
| void main() | ||
| { | ||
| gl_Position = ortho*dimet*vec4(aPos,0.0, 1.0); | ||
| pos =aPos; | ||
| auv = uv; | ||
| tex_ind = terrain_index; | ||
| } |
This file contains hidden or 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 330 | ||
|
|
||
| layout(location=0) in vec2 position; | ||
| layout(location=1) in vec2 uv; | ||
| uniform mat4 proj; | ||
| out vec2 v_uv; | ||
|
|
||
| void main() { | ||
| gl_Position = proj * vec4(position, 0.0, 1.0); | ||
| v_uv = uv; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid this horrible duplication, a
sampler2DArraywould serve well.