forked from 0ad/0ad
Fixes minimap GLES compatibility by making point size a uniform and passing into the shaders
This was SVN commit r15901.
This commit is contained in:
parent
21b83734f9
commit
b4997dc7c6
@ -24,6 +24,7 @@ DP4 result.position.w, program.local[3], position;
|
||||
|
||||
#if MINIMAP_POINT
|
||||
MOV result.color, vertex.color;
|
||||
MOV result.pointsize, program.local[8];
|
||||
#endif
|
||||
|
||||
END
|
||||
|
@ -7,6 +7,7 @@
|
||||
<stream name="color" if="MINIMAP_POINT"/>
|
||||
<uniform name="transform" loc="0" type="mat4"/>
|
||||
<uniform name="textureTransform" loc="4" type="mat4"/>
|
||||
<uniform name="pointSize" loc="8" type="float"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="arb/minimap.fp">
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform mat4 textureTransform;
|
||||
uniform float pointSize;
|
||||
|
||||
#if MINIMAP_BASE || MINIMAP_LOS
|
||||
attribute vec3 a_vertex;
|
||||
@ -27,6 +28,7 @@ void main()
|
||||
#endif
|
||||
|
||||
#if MINIMAP_POINT
|
||||
gl_PointSize = pointSize;
|
||||
gl_Position = transform * vec4(a_vertex, 0.0, 1.0);
|
||||
color = a_color;
|
||||
#endif
|
||||
|
@ -447,6 +447,7 @@ protected:
|
||||
ID_transform,
|
||||
ID_textureTransform,
|
||||
ID_color,
|
||||
ID_pointSize,
|
||||
};
|
||||
public:
|
||||
CShaderProgramFFP_GuiMinimap(const CShaderDefines& defines) :
|
||||
@ -456,6 +457,7 @@ public:
|
||||
SetUniformIndex("transform", ID_transform);
|
||||
SetUniformIndex("textureTransform", ID_textureTransform);
|
||||
SetUniformIndex("color", ID_color);
|
||||
SetUniformIndex("pointSize", ID_pointSize);
|
||||
|
||||
if (m_Defines.GetInt("MINIMAP_BASE") || m_Defines.GetInt("MINIMAP_LOS"))
|
||||
{
|
||||
@ -486,6 +488,8 @@ public:
|
||||
{
|
||||
if (id.second == ID_color)
|
||||
glColor4f(v0, v1, v2, v3);
|
||||
else if (id.second == ID_pointSize)
|
||||
glPointSize(v0);
|
||||
}
|
||||
|
||||
virtual void Bind()
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -495,6 +495,7 @@ void CMiniMap::Draw()
|
||||
tech->BeginPass();
|
||||
shader = tech->GetShader();
|
||||
shader->Uniform(str_transform, baseTransform);
|
||||
shader->Uniform(str_pointSize, 3.f);
|
||||
|
||||
CMatrix3D unitMatrix;
|
||||
unitMatrix.SetIdentity();
|
||||
@ -577,7 +578,10 @@ void CMiniMap::Draw()
|
||||
|
||||
if (m_EntitiesDrawn > 0)
|
||||
{
|
||||
glPointSize(3.f);
|
||||
#if !CONFIG2_GLES
|
||||
if (g_Renderer.GetRenderPath() == CRenderer::RP_SHADER)
|
||||
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
#endif
|
||||
|
||||
u8* indexBase = m_IndexArray.Bind();
|
||||
u8* base = m_VertexArray.Bind();
|
||||
@ -593,7 +597,10 @@ void CMiniMap::Draw()
|
||||
g_Renderer.GetStats().m_DrawCalls++;
|
||||
CVertexBuffer::Unbind();
|
||||
|
||||
glPointSize(1.0f);
|
||||
#if !CONFIG2_GLES
|
||||
if (g_Renderer.GetRenderPath() == CRenderer::RP_SHADER)
|
||||
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
tech->EndPass();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -117,6 +117,7 @@ X(overlay_solid)
|
||||
X(particle)
|
||||
X(particle_solid)
|
||||
X(playerColor)
|
||||
X(pointSize)
|
||||
X(qualityLevel)
|
||||
X(reflectionMap)
|
||||
X(reflectionMatrix)
|
||||
|
Loading…
Reference in New Issue
Block a user