添加组件圆,添加可视化碰撞器渲染
This commit is contained in:
64
Sandbox/assets/shaders/Renderer2D_quad.glsl
Normal file
64
Sandbox/assets/shaders/Renderer2D_quad.glsl
Normal file
@ -0,0 +1,64 @@
|
||||
// Basic quad Texture Shader
|
||||
|
||||
#type vertex
|
||||
#version 450 core
|
||||
|
||||
layout(location = 0) in vec3 a_Position;
|
||||
layout(location = 1) in vec4 a_Color;
|
||||
layout(location = 2) in vec2 a_TexCoord;
|
||||
layout(location = 3) in float a_TexIndex;
|
||||
layout(location = 4) in float a_TilingFactor;
|
||||
layout(location = 5) in int a_EntityID;
|
||||
|
||||
layout(std140, binding = 0) uniform Camera
|
||||
{
|
||||
mat4 u_ViewProjection;
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
vec4 Color;
|
||||
vec2 TexCoord;
|
||||
float TilingFactor;
|
||||
};
|
||||
|
||||
layout (location = 0) out VertexOutput Output;
|
||||
layout (location = 3) out flat float v_TexIndex;
|
||||
layout (location = 4) out flat int v_EntityID;
|
||||
|
||||
void main()
|
||||
{
|
||||
Output.Color = a_Color;
|
||||
Output.TexCoord = a_TexCoord;
|
||||
Output.TilingFactor = a_TilingFactor;
|
||||
v_TexIndex = a_TexIndex;
|
||||
v_EntityID = a_EntityID;
|
||||
|
||||
gl_Position = u_ViewProjection * vec4(a_Position, 1.0);
|
||||
}
|
||||
|
||||
#type fragment
|
||||
#version 450 core
|
||||
|
||||
layout(location = 0) out vec4 o_Color;
|
||||
layout(location = 1) out int o_EntityID;
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
vec4 Color;
|
||||
vec2 TexCoord;
|
||||
float TilingFactor;
|
||||
};
|
||||
|
||||
layout (location = 0) in VertexOutput Input;
|
||||
layout (location = 3) in flat float v_TexIndex;
|
||||
layout (location = 4) in flat int v_EntityID;
|
||||
|
||||
layout (binding = 0) uniform sampler2D u_Textures[32];
|
||||
|
||||
void main()
|
||||
{
|
||||
o_Color = texture(u_Textures[int(v_TexIndex)], Input.TexCoord * Input.TilingFactor) * Input.Color;
|
||||
|
||||
o_EntityID = v_EntityID;
|
||||
}
|
||||
Reference in New Issue
Block a user