Skip to content

Commit

Permalink
Add debug textures, move shader sources our of C++ code, partially fi…
Browse files Browse the repository at this point in the history
…xed transforms on map.
  • Loading branch information
DronCode committed Oct 10, 2023
1 parent 4a56c4f commit 194edec
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 111 deletions.
8 changes: 8 additions & 0 deletions BMEdit/Editor/Resources/BMEdit.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@
<file alias="weapon_icon.png">Icons/Glacier/Weapon.png</file>
<file alias="cloth_icon.png">Icons/Glacier/Cloth.png</file>
<file alias="unknown_icon.png">Icons/Glacier/Unknown.png</file>

<file alias="mtl_unsupported.png">Textures/unsupported_material.png</file>
<file alias="mtl_missing_texture.png">Textures/missing_texture.png</file>

<file alias="mtl_colored_gl33.vsh">Shaders/ColoredEntity_GL33.vsh</file>
<file alias="mtl_colored_gl33.fsh">Shaders/ColoredEntity_GL33.fsh</file>
<file alias="mtl_textured_gl33.vsh">Shaders/TexturedEntity_GL33.vsh</file>
<file alias="mtl_textured_gl33.fsh">Shaders/TexturedEntity_GL33.fsh</file>
</qresource>
</RCC>
15 changes: 15 additions & 0 deletions BMEdit/Editor/Resources/Shaders/ColoredEntity_GL33.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 330 core
//
// This file is a part of BMEdit project
// Description: Basic shader to render color filled entity & gizmo
//

uniform vec4 i_Color;

// Out
out vec4 o_FragColor;

void main()
{
o_FragColor = i_Color;
}
30 changes: 30 additions & 0 deletions BMEdit/Editor/Resources/Shaders/ColoredEntity_GL33.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#version 330 core
//
// This file is a part of BMEdit project
// Description: Basic shader to render color filled entity & gizmo
//

// Layout
layout (location = 0) in vec3 aPos;

// Common
struct Camera
{
mat4 proj;
mat4 view;
ivec2 resolution;
};

struct Transform
{
mat4 model;
};

// Uniforms
uniform Camera i_uCamera;
uniform Transform i_uTransform;

void main()
{
gl_Position = i_uCamera.proj * i_uCamera.view * i_uTransform.model * vec4(aPos.x, aPos.y, aPos.z, 1.0);
}
16 changes: 16 additions & 0 deletions BMEdit/Editor/Resources/Shaders/TexturedEntity_GL33.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#version 330 core
//
// This file is a part of BMEdit project
// Description: Basic shader to render textured entity
//

uniform sampler2D i_ActiveTexture;
in vec2 g_TexCoord;

// Out
out vec4 o_FragColor;

void main()
{
o_FragColor = texture(i_ActiveTexture, g_TexCoord);
}
35 changes: 35 additions & 0 deletions BMEdit/Editor/Resources/Shaders/TexturedEntity_GL33.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#version 330 core
//
// This file is a part of BMEdit project
// Description: Basic shader to render textured entity
//

// Layout
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aUV;

// Common
struct Camera
{
mat4 proj;
mat4 view;
ivec2 resolution;
};

struct Transform
{
mat4 model;
};

// Uniforms
uniform Camera i_uCamera;
uniform Transform i_uTransform;

// Out
out vec2 g_TexCoord;

void main()
{
gl_Position = i_uCamera.proj * i_uCamera.view * i_uTransform.model * vec4(aPos.x, aPos.y, aPos.z, 1.0);
g_TexCoord = aUV;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 194edec

Please sign in to comment.