mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
random testing bits trying to isolate remaining forward issues.
This commit is contained in:
parent
093f50bd9d
commit
6db975e81c
5 changed files with 77 additions and 28 deletions
|
|
@ -354,15 +354,15 @@ void GFXGLCubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCount)
|
|||
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, mCubemap);
|
||||
const U32 mipSize = getMax(U32(1), mSize >> currentMip);
|
||||
/*if (isCompressed)
|
||||
if (isCompressed)
|
||||
{
|
||||
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
|
||||
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], mipSize, mipSize, 0, mipDataSize, pixelData);
|
||||
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], 0, 0, i * 6 + face, 0, mipDataSize, pixelData);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, i * 6 + face, mipSize, mipSize, 1, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
|
||||
//}
|
||||
{
|
||||
glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, i * 6 + face, mipSize, mipSize, 1, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, 0);
|
||||
|
||||
delete[] pixelData;
|
||||
|
|
@ -415,15 +415,15 @@ void GFXGLCubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32
|
|||
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, mCubemap);
|
||||
const U32 mipSize = getMax(U32(1), mSize >> currentMip);
|
||||
/*if (isCompressed)
|
||||
if (isCompressed)
|
||||
{
|
||||
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
|
||||
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], mipSize, mipSize, 0, mipDataSize, pixelData);
|
||||
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], 0, 0, slot * 6 + face, 0, mipDataSize, pixelData);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
{
|
||||
glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, slot * 6 + face, mipSize, mipSize, 1, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
|
||||
//}
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, 0);
|
||||
|
||||
delete[] pixelData;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,19 @@ void ProbeShaderConstants::init(GFXShader* shader)
|
|||
mInit = true;
|
||||
}
|
||||
|
||||
bool ProbeShaderConstants::isValid()
|
||||
{
|
||||
if (mProbePositionSC->isValid() ||
|
||||
mProbeConfigDataSC->isValid() ||
|
||||
mProbeBoxMinSC->isValid() ||
|
||||
mProbeBoxMaxSC->isValid() ||
|
||||
mProbeSpecularCubemapSC->isValid() ||
|
||||
mProbeIrradianceCubemapSC->isValid())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProbeShaderConstants::_onShaderReload()
|
||||
{
|
||||
if (mShader.isValid())
|
||||
|
|
@ -536,12 +549,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
|||
PROFILE_SCOPE(ProbeManager_Update4ProbeConsts);
|
||||
|
||||
// Skip over gathering lights if we don't have to!
|
||||
if (probeShaderConsts->mProbePositionSC->isValid() ||
|
||||
probeShaderConsts->mProbeConfigDataSC->isValid() ||
|
||||
probeShaderConsts->mProbeBoxMinSC->isValid() ||
|
||||
probeShaderConsts->mProbeBoxMaxSC->isValid() ||
|
||||
probeShaderConsts->mProbeSpecularCubemapSC->isValid() ||
|
||||
probeShaderConsts->mProbeIrradianceCubemapSC->isValid()/* && (!ProbeRenderInst::all.empty())*/)
|
||||
if (probeShaderConsts->isValid())
|
||||
{
|
||||
PROFILE_SCOPE(ProbeManager_Update4ProbeConsts_setProbes);
|
||||
|
||||
|
|
@ -653,7 +661,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
|||
if (!curEntry.mIsEnabled)
|
||||
continue;
|
||||
|
||||
if (curEntry.mIsSkylight)
|
||||
/*if (curEntry.mIsSkylight)
|
||||
{
|
||||
if (curEntry.mPrefilterCubemap.isValid() && curEntry.mPrefilterCubemap.isValid())
|
||||
{
|
||||
|
|
@ -664,8 +672,8 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
|||
hasSkylight = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
}*/
|
||||
if(!curEntry.mIsSkylight)
|
||||
{
|
||||
/*probePositions[effectiveProbeCount] = curEntry.getPosition();
|
||||
probeRefPositions[effectiveProbeCount] = curEntry.mProbeRefOffset;
|
||||
|
|
@ -694,6 +702,39 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
|||
//GFX->setCubeArrayTexture(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister(), mPrefilterArray);
|
||||
//GFX->setCubeArrayTexture(probeShaderConsts->mProbeIrradianceCubemapSC->getSamplerRegister(), mIrradianceArray);
|
||||
|
||||
//if (!hasSkylight)
|
||||
// shaderConsts->setSafe(probeShaderConsts->mHasSkylight, 0.0f);
|
||||
}
|
||||
|
||||
//check for skylight action
|
||||
if (probeShaderConsts->mHasSkylight->isValid()
|
||||
&& probeShaderConsts->mSkylightIrradMap->isValid()
|
||||
&& probeShaderConsts->mSkylightSpecularMap->isValid())
|
||||
{
|
||||
//Array rendering
|
||||
U32 probeCount = ProbeRenderInst::all.size();
|
||||
|
||||
bool hasSkylight = false;
|
||||
for (U32 i = 0; i < probeCount; i++)
|
||||
{
|
||||
const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i];
|
||||
if (!curEntry.mIsEnabled)
|
||||
continue;
|
||||
|
||||
if (curEntry.mIsSkylight)
|
||||
{
|
||||
if (curEntry.mPrefilterCubemap.isValid() && curEntry.mPrefilterCubemap.isValid())
|
||||
{
|
||||
GFX->setCubeTexture(probeShaderConsts->mSkylightSpecularMap->getSamplerRegister(), curEntry.mPrefilterCubemap);
|
||||
GFX->setCubeTexture(probeShaderConsts->mSkylightIrradMap->getSamplerRegister(), curEntry.mIrradianceCubemap);
|
||||
|
||||
shaderConsts->setSafe(probeShaderConsts->mHasSkylight, 1.0f);
|
||||
hasSkylight = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasSkylight)
|
||||
shaderConsts->setSafe(probeShaderConsts->mHasSkylight, 0.0f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ struct ProbeShaderConstants
|
|||
|
||||
void init(GFXShader* buffer);
|
||||
|
||||
bool isValid();
|
||||
|
||||
void _onShaderReload();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3134,7 +3134,11 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
|
||||
Var *wsEyePos = (Var*)LangElement::find("eyePosWorld");
|
||||
|
||||
Var *worldToCamera = (Var*)LangElement::find("worldToCamera");
|
||||
Var *worldToTangent = (Var*)LangElement::find("worldToTangent");
|
||||
if (!worldToTangent)
|
||||
return;
|
||||
|
||||
/*Var *worldToCamera = (Var*)LangElement::find("worldToCamera");
|
||||
if (!worldToCamera)
|
||||
{
|
||||
worldToCamera = new Var;
|
||||
|
|
@ -3142,13 +3146,13 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
worldToCamera->setName("worldToCamera");
|
||||
worldToCamera->uniform = true;
|
||||
worldToCamera->constSortPos = cspPass;
|
||||
}
|
||||
}*/
|
||||
|
||||
//Reflection vec
|
||||
Var *surface = new Var("surface", "Surface");
|
||||
meta->addStatement(new GenOp(" @ = createForwardSurface(@,@,@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, bumpNormal, matinfo,
|
||||
inTex, wsPosition, wsEyePos, wsView, worldToCamera));
|
||||
String computeForwardProbes = String::String(" @.rgb += computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
inTex, wsPosition, wsEyePos, wsView, worldToTangent));
|
||||
String computeForwardProbes = String::String(" @.rgb = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String::String("@,TORQUE_SAMPLER2D_MAKEARG(@),\r\n\t\t");
|
||||
computeForwardProbes += String::String("TORQUE_SAMPLERCUBE_MAKEARG(@), TORQUE_SAMPLERCUBE_MAKEARG(@), \r\n\t\t");
|
||||
computeForwardProbes += String::String("TORQUE_SAMPLERCUBEARRAY_MAKEARG(@),TORQUE_SAMPLERCUBEARRAY_MAKEARG(@)).rgb; \r\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue