mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Support 'barycoords' vertex attribute in unbuffered drawer.
This commit is contained in:
parent
61172283c1
commit
2233cf9f04
|
@ -8,14 +8,14 @@ namespace opengl {
|
||||||
const GLuint texcoord = 2U;
|
const GLuint texcoord = 2U;
|
||||||
const GLuint numlights = 3U;
|
const GLuint numlights = 3U;
|
||||||
const GLuint modify = 4U;
|
const GLuint modify = 4U;
|
||||||
const GLuint barycoords = 8U;
|
const GLuint barycoords = 5U;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rect attributes
|
// Rect attributes
|
||||||
namespace rectAttrib {
|
namespace rectAttrib {
|
||||||
const GLuint position = 5U;
|
const GLuint position = 6U;
|
||||||
const GLuint texcoord0 = 6U;
|
const GLuint texcoord0 = 7U;
|
||||||
const GLuint texcoord1 = 7U;
|
const GLuint texcoord1 = 8U;
|
||||||
const GLuint barycoords = 9U;
|
const GLuint barycoords = 9U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,12 @@ UnbufferedDrawer::UnbufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArr
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::numlights, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::numlights, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
||||||
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false);
|
||||||
|
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
||||||
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, false);
|
||||||
|
|
||||||
m_attribsData.fill(nullptr);
|
m_attribsData.fill(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -69,12 +71,20 @@ void UnbufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParame
|
||||||
glVertexAttribPointer(triangleAttrib::modify, 4, GL_BYTE, GL_FALSE, sizeof(SPVertex), ptr);
|
glVertexAttribPointer(triangleAttrib::modify, 4, GL_BYTE, GL_FALSE, sizeof(SPVertex), ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, true);
|
||||||
|
const void * ptr = &_params.vertices->bc0;
|
||||||
|
if (_updateAttribPointer(triangleAttrib::barycoords, ptr))
|
||||||
|
glVertexAttribPointer(triangleAttrib::barycoords, 3, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr);
|
||||||
|
}
|
||||||
|
|
||||||
if (isHWLightingAllowed())
|
if (isHWLightingAllowed())
|
||||||
glVertexAttrib1f(triangleAttrib::numlights, GLfloat(_params.vertices[0].HWLight));
|
glVertexAttrib1f(triangleAttrib::numlights, GLfloat(_params.vertices[0].HWLight));
|
||||||
|
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
||||||
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, false);
|
||||||
|
|
||||||
if (config.frameBufferEmulation.N64DepthCompare != Config::dcCompatible) {
|
if (config.frameBufferEmulation.N64DepthCompare != Config::dcCompatible) {
|
||||||
if (_params.elements == nullptr) {
|
if (_params.elements == nullptr) {
|
||||||
|
@ -133,10 +143,18 @@ void UnbufferedDrawer::drawRects(const graphics::Context::DrawRectParameters & _
|
||||||
} else
|
} else
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
||||||
|
|
||||||
|
{
|
||||||
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, true);
|
||||||
|
const void * ptr = &_params.vertices->bc0;
|
||||||
|
if (_updateAttribPointer(rectAttrib::barycoords, ptr))
|
||||||
|
glVertexAttribPointer(rectAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), ptr);
|
||||||
|
}
|
||||||
|
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
||||||
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false);
|
||||||
|
|
||||||
glDrawArrays(GLenum(_params.mode), 0, _params.verticesCount);
|
glDrawArrays(GLenum(_params.mode), 0, _params.verticesCount);
|
||||||
}
|
}
|
||||||
|
@ -159,6 +177,7 @@ void UnbufferedDrawer::drawLine(f32 _width, SPVertex * _vertices)
|
||||||
|
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
||||||
|
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false);
|
||||||
|
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
||||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
||||||
|
|
|
@ -40,10 +40,10 @@ struct SPVertex
|
||||||
f32 r, g, b, a;
|
f32 r, g, b, a;
|
||||||
f32 flat_r, flat_g, flat_b, flat_a;
|
f32 flat_r, flat_g, flat_b, flat_a;
|
||||||
f32 s, t;
|
f32 s, t;
|
||||||
|
f32 bc0, bc1, bc2;
|
||||||
u32 modify;
|
u32 modify;
|
||||||
u8 HWLight;
|
u8 HWLight;
|
||||||
u8 clip;
|
u8 clip;
|
||||||
f32 bc0, bc1, bc2;
|
|
||||||
s16 flag;
|
s16 flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user