Some fixes
This commit is contained in:
parent
f67f207d4b
commit
ce7f017adf
27
data/shaders/primitive2dlist.vert
Normal file
27
data/shaders/primitive2dlist.vert
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#if __VERSION__ >= 330
|
||||||
|
layout(location = 0) in vec3 Position;
|
||||||
|
layout(location = 1) in vec3 Normal;
|
||||||
|
layout(location = 2) in vec4 Color;
|
||||||
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
layout(location = 4) in vec2 SecondTexcoord;
|
||||||
|
layout(location = 5) in vec3 Tangent;
|
||||||
|
layout(location = 6) in vec3 Bitangent;
|
||||||
|
#else
|
||||||
|
in vec3 Position;
|
||||||
|
in vec3 Normal;
|
||||||
|
in vec4 Color;
|
||||||
|
in vec2 Texcoord;
|
||||||
|
in vec2 SecondTexcoord;
|
||||||
|
in vec3 Tangent;
|
||||||
|
in vec3 Bitangent;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
out vec2 uv;
|
||||||
|
out vec4 color;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
color = Color.zyxw;
|
||||||
|
gl_Position = vec4(Position, 1.) / vec4(screen, 1., 1.);
|
||||||
|
uv = Texcoord;
|
||||||
|
}
|
@ -665,21 +665,24 @@ void draw2DVertexPrimitiveList(const void* vertices,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GLuint tmpvao, tmpvbo, tmpibo;
|
GLuint tmpvao, tmpvbo, tmpibo;
|
||||||
|
primitiveCount += 2;
|
||||||
glGenVertexArrays(1, &tmpvao);
|
glGenVertexArrays(1, &tmpvao);
|
||||||
glBindVertexArray(tmpvao);
|
glBindVertexArray(tmpvao);
|
||||||
glGenBuffers(1, &tmpvbo);
|
glGenBuffers(1, &tmpvbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, tmpvbo);
|
glBindBuffer(GL_ARRAY_BUFFER, tmpvbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, vertexCount * getVertexPitchFromType(vType), vertices, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, vertexCount * getVertexPitchFromType(vType), vertices, GL_STREAM_DRAW);
|
||||||
glGenBuffers(1, &tmpibo);
|
glGenBuffers(1, &tmpibo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, tmpibo);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, tmpibo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, primitiveCount * sizeof(u16), indexList, GL_STREAM_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, primitiveCount * sizeof(u16), indexList, GL_STREAM_DRAW);
|
||||||
|
|
||||||
glUseProgram(MeshShader::TransparentShader::getInstance()->Program);
|
VertexUtils::bindVertexArrayAttrib(vType);
|
||||||
MeshShader::TransparentShader::getInstance()->setUniforms(core::IdentityMatrix, core::IdentityMatrix);
|
|
||||||
|
glUseProgram(UIShader::Primitive2DList::getInstance()->Program);
|
||||||
|
UIShader::Primitive2DList::getInstance()->setUniforms();
|
||||||
const video::SOverrideMaterial &m = irr_driver->getVideoDriver()->getOverrideMaterial();
|
const video::SOverrideMaterial &m = irr_driver->getVideoDriver()->getOverrideMaterial();
|
||||||
video::ITexture* tex = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
video::ITexture* tex = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
||||||
compressTexture(tex, false);
|
compressTexture(tex, false);
|
||||||
MeshShader::TransparentShader::getInstance()->SetTextureUnits({ getTextureGLuint(tex) });
|
UIShader::Primitive2DList::getInstance()->SetTextureUnits({ getTextureGLuint(tex) });
|
||||||
glDrawElements(GL_TRIANGLE_FAN, primitiveCount, GL_UNSIGNED_SHORT, 0);
|
glDrawElements(GL_TRIANGLE_FAN, primitiveCount, GL_UNSIGNED_SHORT, 0);
|
||||||
|
|
||||||
glDeleteVertexArrays(1, &tmpvao);
|
glDeleteVertexArrays(1, &tmpvao);
|
||||||
|
@ -1749,6 +1749,16 @@ namespace FullScreenShader
|
|||||||
|
|
||||||
namespace UIShader
|
namespace UIShader
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Primitive2DList::Primitive2DList()
|
||||||
|
{
|
||||||
|
Program = LoadProgram(OBJECT,
|
||||||
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/primitive2dlist.vert").c_str(),
|
||||||
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparent.frag").c_str());
|
||||||
|
AssignUniforms();
|
||||||
|
AssignSamplerNames(Program, 0, "tex");
|
||||||
|
}
|
||||||
|
|
||||||
TextureRectShader::TextureRectShader()
|
TextureRectShader::TextureRectShader()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(OBJECT,
|
Program = LoadProgram(OBJECT,
|
||||||
|
@ -580,6 +580,13 @@ public:
|
|||||||
|
|
||||||
namespace UIShader
|
namespace UIShader
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class Primitive2DList : public ShaderHelperSingleton<Primitive2DList>, public TextureRead < Bilinear_Filtered >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Primitive2DList();
|
||||||
|
};
|
||||||
|
|
||||||
class TextureRectShader : public ShaderHelperSingleton<TextureRectShader, core::vector2df, core::vector2df, core::vector2df, core::vector2df>, public TextureRead<Bilinear_Filtered>
|
class TextureRectShader : public ShaderHelperSingleton<TextureRectShader, core::vector2df, core::vector2df, core::vector2df, core::vector2df>, public TextureRead<Bilinear_Filtered>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user