Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into alpha41/cmake_adjustments

This commit is contained in:
AzaezelX 2023-07-21 08:53:46 -05:00
commit 2866b3afd6
10 changed files with 47 additions and 19 deletions

View file

@ -186,10 +186,11 @@ GFXD3D11StateBlock::GFXD3D11StateBlock(const GFXStateBlockDesc& desc)
else else
mSamplerDesc[i].Filter = comparison ? D3D11_FILTER_COMPARISON_ANISOTROPIC : D3D11_FILTER_ANISOTROPIC; mSamplerDesc[i].Filter = comparison ? D3D11_FILTER_COMPARISON_ANISOTROPIC : D3D11_FILTER_ANISOTROPIC;
mSamplerDesc[i].BorderColor[0] = 1.0f; LinearColorF bc = LinearColorF(gfxSamplerState.borderColor);
mSamplerDesc[i].BorderColor[1] = 1.0f; mSamplerDesc[i].BorderColor[0] = bc.red;
mSamplerDesc[i].BorderColor[2] = 1.0f; mSamplerDesc[i].BorderColor[1] = bc.green;
mSamplerDesc[i].BorderColor[3] = 1.0f; mSamplerDesc[i].BorderColor[2] = bc.blue;
mSamplerDesc[i].BorderColor[3] = bc.alpha;
mSamplerDesc[i].ComparisonFunc = GFXD3D11CmpFunc[gfxSamplerState.samplerFunc]; mSamplerDesc[i].ComparisonFunc = GFXD3D11CmpFunc[gfxSamplerState.samplerFunc];
hr = D3D11DEVICE->CreateSamplerState(&mSamplerDesc[i], &mSamplerStates[i]); hr = D3D11DEVICE->CreateSamplerState(&mSamplerDesc[i], &mSamplerStates[i]);

View file

@ -333,17 +333,26 @@ GFXAdapter *GFXInit::getBestAdapterChoice()
} }
} }
// Return best found in order DX11, GL if (renderer.equal("NullDevice", String::NoCase) == false)
if (foundAdapter11) {
return foundAdapter11; // Return best found in order DX11, GL
if (foundAdapter11)
return foundAdapter11;
if (foundAdapterGL) if (foundAdapterGL)
return foundAdapterGL; return foundAdapterGL;
// Uh oh - we didn't find anything. Grab whatever we can that's not Null... // Uh oh - we didn't find anything. Grab whatever we can that's not Null...
for(S32 i=0; i<smAdapters.size(); i++) for (S32 i = 0; i < smAdapters.size(); i++)
if(smAdapters[i]->mType != NullDevice) if (smAdapters[i]->mType != NullDevice)
return smAdapters[i]; return smAdapters[i];
}
else
{
for (S32 i = 0; i < smAdapters.size(); i++)
if (smAdapters[i]->mType == NullDevice)
return smAdapters[i];
}
// Dare we return a null device? No. Just return NULL. // Dare we return a null device? No. Just return NULL.
return NULL; return NULL;

View file

@ -278,6 +278,7 @@ GFXSamplerStateDesc::GFXSamplerStateDesc()
samplerFunc = GFXCmpNever; samplerFunc = GFXCmpNever;
maxAnisotropy = 1; maxAnisotropy = 1;
mipLODBias = 0.0f; mipLODBias = 0.0f;
borderColor = ColorI::WHITE;
} }
GFXSamplerStateDesc GFXSamplerStateDesc::getWrapLinear() GFXSamplerStateDesc GFXSamplerStateDesc::getWrapLinear()

View file

@ -49,6 +49,8 @@ struct GFXSamplerStateDesc
GFXCmpFunc samplerFunc; GFXCmpFunc samplerFunc;
ColorI borderColor;
/// The maximum anisotropy used when one of the filter types /// The maximum anisotropy used when one of the filter types
/// is set to anisotropic. /// is set to anisotropic.
/// ///

View file

@ -93,7 +93,7 @@ void GFXGLEnumTranslate::init()
GFXGLTextureAddress[GFXAddressWrap] = GL_REPEAT; GFXGLTextureAddress[GFXAddressWrap] = GL_REPEAT;
GFXGLTextureAddress[GFXAddressMirror] = GL_REPEAT; GFXGLTextureAddress[GFXAddressMirror] = GL_REPEAT;
GFXGLTextureAddress[GFXAddressClamp] = GL_CLAMP_TO_EDGE; GFXGLTextureAddress[GFXAddressClamp] = GL_CLAMP_TO_EDGE;
GFXGLTextureAddress[GFXAddressBorder] = GL_REPEAT; GFXGLTextureAddress[GFXAddressBorder] = GL_CLAMP_TO_BORDER;
GFXGLTextureAddress[GFXAddressMirrorOnce] = GL_REPEAT; GFXGLTextureAddress[GFXAddressMirrorOnce] = GL_REPEAT;
// Stencil ops // Stencil ops

View file

@ -55,7 +55,16 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) :
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]); glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]); glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]); glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]);
if (ssd.addressModeU == GFXAddressBorder ||
ssd.addressModeV == GFXAddressBorder ||
ssd.addressModeW == GFXAddressBorder)
{
LinearColorF bc = LinearColorF(ssd.borderColor);
GLfloat color[4] = { bc.red, bc.green, bc.blue, bc.alpha };
glSamplerParameterfv(id, GL_TEXTURE_BORDER_COLOR, color);
}
//compare modes //compare modes
const bool comparison = ssd.samplerFunc != GFXCmpNever; const bool comparison = ssd.samplerFunc != GFXCmpNever;
glSamplerParameteri(id, GL_TEXTURE_COMPARE_MODE, comparison ? GL_COMPARE_R_TO_TEXTURE_ARB : GL_NONE ); glSamplerParameteri(id, GL_TEXTURE_COMPARE_MODE, comparison ? GL_COMPARE_R_TO_TEXTURE_ARB : GL_NONE );

View file

@ -219,7 +219,7 @@ void GFXGLTextureObject::initSamplerState(const GFXSamplerStateDesc &ssd)
glTexParameteri(mBinding, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]); glTexParameteri(mBinding, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]);
if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() ) if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() )
glTexParameterf(mBinding, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy); glTexParameterf(mBinding, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy);
mNeedInitSamplerState = false; mNeedInitSamplerState = false;
mSampler = ssd; mSampler = ssd;
} }

View file

@ -315,6 +315,8 @@ void GFXSamplerStateData::initPersistFields()
endGroup( "Filter State" ); endGroup( "Filter State" );
addField("borderColor", TypeColorI, Offset(mState.borderColor, GFXSamplerStateData), "");
addField("samplerFunc", TypeGFXCmpFunc, Offset(mState.samplerFunc, GFXSamplerStateData), addField("samplerFunc", TypeGFXCmpFunc, Offset(mState.samplerFunc, GFXSamplerStateData),
"Compares sampled data against existing sampled data. The default is GFXCmpNever."); "Compares sampled data against existing sampled data. The default is GFXCmpNever.");
} }

View file

@ -68,13 +68,17 @@ TEST(File, TouchAndTime)
// Touch a file and note its last-modified. // Touch a file and note its last-modified.
dFileTouch("testTouch.file"); dFileTouch("testTouch.file");
// Sleep for a tick
Platform::sleep(32);
EXPECT_TRUE(Platform::isFile("testTouch.file")) EXPECT_TRUE(Platform::isFile("testTouch.file"))
<< "We just touched this file - it should exist."; << "We just touched this file - it should exist.";
EXPECT_TRUE(Platform::getFileTimes("testTouch.file", &create[0], &modify[0])) EXPECT_TRUE(Platform::getFileTimes("testTouch.file", &create[0], &modify[0]))
<< "Failed to get filetimes for a file we just created."; << "Failed to get filetimes for a file we just created.";
// Sleep for a tick // Sleep for a tick
Platform::sleep(10); Platform::sleep(32);
// Touch it again, and compare the last-modifieds. // Touch it again, and compare the last-modifieds.
EXPECT_TRUE(Platform::isFile("testTouch.file")) EXPECT_TRUE(Platform::isFile("testTouch.file"))

View file

@ -24,10 +24,10 @@ function ExampleModule::onCreateGameServer(%this)
%this.registerDatablock("./scripts/managedData/managedForestItemData"); %this.registerDatablock("./scripts/managedData/managedForestItemData");
if(isFile("./scripts/managedData/managedForestBrushData." @ $TorqueScriptFileExtension)) if(isFile("./scripts/managedData/managedForestBrushData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedForestBrushData"); %this.registerDatablock("./scripts/managedData/managedForestBrushData");
if(isFile("./scripts/managedData/managedParticleEmitterData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedParticleEmitterData");
if(isFile("./scripts/managedData/managedParticleData." @ $TorqueScriptFileExtension)) if(isFile("./scripts/managedData/managedParticleData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedParticleData"); %this.registerDatablock("./scripts/managedData/managedParticleData");
if(isFile("./scripts/managedData/managedParticleEmitterData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedParticleEmitterData");
} }
//This is called when the server is shut down due to the game/map being exited //This is called when the server is shut down due to the game/map being exited