mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-24 00:53:47 +00:00
Merge pull request #619 from BeamNG/gfxshader_init_ordered_samplers
Add GFXShader::init with support for ordered vector of sampler names for shader.
This commit is contained in:
commit
4d7ffad284
2 changed files with 30 additions and 0 deletions
|
|
@ -45,16 +45,29 @@ GFXShader::~GFXShader()
|
|||
Torque::FS::RemoveChangeNotification( mPixelFile, this, &GFXShader::_onFileChanged );
|
||||
}
|
||||
|
||||
#ifndef TORQUE_OPENGL
|
||||
bool GFXShader::init( const Torque::Path &vertFile,
|
||||
const Torque::Path &pixFile,
|
||||
F32 pixVersion,
|
||||
const Vector<GFXShaderMacro> ¯os )
|
||||
{
|
||||
Vector<String> samplerNames;
|
||||
return init( vertFile, pixFile, pixVersion, macros, samplerNames );
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GFXShader::init( const Torque::Path &vertFile,
|
||||
const Torque::Path &pixFile,
|
||||
F32 pixVersion,
|
||||
const Vector<GFXShaderMacro> ¯os,
|
||||
const Vector<String> &samplerNames)
|
||||
{
|
||||
// Store the inputs for use in reloading.
|
||||
mVertexFile = vertFile;
|
||||
mPixelFile = pixFile;
|
||||
mPixVersion = pixVersion;
|
||||
mMacros = macros;
|
||||
mSamplerNamesOrdered = samplerNames;
|
||||
|
||||
// Before we compile the shader make sure the
|
||||
// conditioner features have been updated.
|
||||
|
|
|
|||
|
|
@ -237,6 +237,13 @@ protected:
|
|||
/// The macros to be passed to the shader.
|
||||
Vector<GFXShaderMacro> mMacros;
|
||||
|
||||
/// Ordered SamplerNames
|
||||
/// We need to store a list of sampler for allow OpenGL to
|
||||
/// assign correct location for each sampler.
|
||||
/// GLSL 150 not allow explicit uniform location.
|
||||
/// Only used on OpenGL
|
||||
Vector<String> mSamplerNamesOrdered;
|
||||
|
||||
/// The pixel version this is compiled for.
|
||||
F32 mPixVersion;
|
||||
|
||||
|
|
@ -292,10 +299,20 @@ public:
|
|||
virtual ~GFXShader();
|
||||
|
||||
///
|
||||
/// Deprecated. Remove on T3D 4.0
|
||||
#ifndef TORQUE_OPENGL
|
||||
bool init( const Torque::Path &vertFile,
|
||||
const Torque::Path &pixFile,
|
||||
F32 pixVersion,
|
||||
const Vector<GFXShaderMacro> ¯os );
|
||||
#endif
|
||||
|
||||
///
|
||||
bool init( const Torque::Path &vertFile,
|
||||
const Torque::Path &pixFile,
|
||||
F32 pixVersion,
|
||||
const Vector<GFXShaderMacro> ¯os,
|
||||
const Vector<String> &samplerNames);
|
||||
|
||||
/// Reloads the shader from disk.
|
||||
bool reload();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue