mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-14 04:03:46 +00:00
Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy
This commit is contained in:
parent
8780f83262
commit
25686ed4be
294 changed files with 3894 additions and 2813 deletions
|
|
@ -180,6 +180,9 @@ void GFXGLDevice::initGLState()
|
|||
GLuint vao;
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
|
||||
//enable sRGB
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
}
|
||||
|
||||
void GFXGLDevice::vsyncCallback()
|
||||
|
|
@ -450,7 +453,7 @@ void GFXGLDevice::endSceneInternal()
|
|||
mCanCurrentlyRender = false;
|
||||
}
|
||||
|
||||
void GFXGLDevice::clear(U32 flags, ColorI color, F32 z, U32 stencil)
|
||||
void GFXGLDevice::clear(U32 flags, const LinearColorF& color, F32 z, U32 stencil)
|
||||
{
|
||||
// Make sure we have flushed our render target state.
|
||||
_updateRenderTargets();
|
||||
|
|
@ -470,10 +473,7 @@ void GFXGLDevice::clear(U32 flags, ColorI color, F32 z, U32 stencil)
|
|||
glColorMask(true, true, true, true);
|
||||
glDepthMask(true);
|
||||
glStencilMask(0xFFFFFFFF);
|
||||
|
||||
|
||||
ColorF c = color;
|
||||
glClearColor(c.red, c.green, c.blue, c.alpha);
|
||||
glClearColor(color.red, color.green, color.blue, color.alpha);
|
||||
glClearDepth(z);
|
||||
glClearStencil(stencil);
|
||||
|
||||
|
|
@ -581,7 +581,8 @@ void GFXGLDevice::drawPrimitive( GFXPrimitiveType primType, U32 vertexStart, U32
|
|||
{
|
||||
preDrawPrimitive();
|
||||
|
||||
vertexStart += mCurrentVB[0]->mBufferVertexOffset;
|
||||
if(mCurrentVB[0])
|
||||
vertexStart += mCurrentVB[0]->mBufferVertexOffset;
|
||||
|
||||
if(mDrawInstancesCount)
|
||||
glDrawArraysInstanced(GFXGLPrimType[primType], vertexStart, primCountToIndexCount(primType, primitiveCount), mDrawInstancesCount);
|
||||
|
|
@ -629,7 +630,7 @@ void GFXGLDevice::setLightMaterialInternal(const GFXLightMaterial mat)
|
|||
// ONLY NEEDED ON FFP
|
||||
}
|
||||
|
||||
void GFXGLDevice::setGlobalAmbientInternal(ColorF color)
|
||||
void GFXGLDevice::setGlobalAmbientInternal(LinearColorF color)
|
||||
{
|
||||
// ONLY NEEDED ON FFP
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue