Remove "simple" shaders
parent
daf34b5656
commit
c26faf70e2
|
@ -1,7 +0,0 @@
|
|||
#version 120
|
||||
uniform vec4 color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_FragColor = color;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
#version 120
|
||||
uniform float s;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 p = vec4(gl_Vertex.xy * s, 0.0f, 1.0f);
|
||||
gl_Position = gl_ModelViewProjectionMatrix * p;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
#version 110
|
||||
|
||||
uniform vec4 color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_FragColor = color;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#version 110
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = ftransform();
|
||||
}
|
|
@ -255,11 +255,6 @@ ShaderProperties::usesTangentSpaceLighting() const
|
|||
|
||||
bool operator<(const ShaderProperties& p0, const ShaderProperties& p1)
|
||||
{
|
||||
if (p0.simpleProps < p1.simpleProps)
|
||||
return true;
|
||||
if (p1.simpleProps < p0.simpleProps)
|
||||
return false;
|
||||
|
||||
if (p0.texUsage < p1.texUsage)
|
||||
return true;
|
||||
if (p1.texUsage < p0.texUsage)
|
||||
|
@ -3093,80 +3088,6 @@ ShaderManager::buildParticleFragmentShader(const ShaderProperties& props)
|
|||
return status == ShaderStatus_OK ? fs : nullptr;
|
||||
}
|
||||
|
||||
GLVertexShader*
|
||||
ShaderManager::buildSimpleVertexShader(uint32_t props)
|
||||
{
|
||||
ostringstream source;
|
||||
|
||||
source << CommonHeader;
|
||||
|
||||
if (props & ShaderProperties::PerVertexColor)
|
||||
source << DeclareVarying("color", Shader_Vector4);
|
||||
|
||||
if (props & ShaderProperties::HasTexture)
|
||||
source << DeclareVarying("texCoord", Shader_Vector2);
|
||||
|
||||
// Begin main()
|
||||
source << "\nvoid main(void)\n";
|
||||
source << "{\n";
|
||||
|
||||
if (props & ShaderProperties::PerVertexColor)
|
||||
source << " color = gl_Color;\n";
|
||||
if (props & ShaderProperties::HasTexture)
|
||||
source << " texCoord = gl_MultiTexCoord0.st;\n";
|
||||
source << " gl_Position = ftransform();\n";
|
||||
|
||||
source << "}\n";
|
||||
// End of main()
|
||||
|
||||
DumpVSSource(source);
|
||||
|
||||
GLVertexShader* vs = nullptr;
|
||||
GLShaderStatus status = GLShaderLoader::CreateVertexShader(source.str(), &vs);
|
||||
return status == ShaderStatus_OK ? vs : nullptr;
|
||||
}
|
||||
|
||||
|
||||
GLFragmentShader*
|
||||
ShaderManager::buildSimpleFragmentShader(uint32_t props)
|
||||
{
|
||||
ostringstream source;
|
||||
|
||||
source << CommonHeader;
|
||||
|
||||
if (props & ShaderProperties::UniformColor)
|
||||
source << DeclareUniform("color", Shader_Vector4);
|
||||
|
||||
if (props & ShaderProperties::HasTexture)
|
||||
{
|
||||
source << DeclareUniform("tex", Shader_Sampler2D);
|
||||
source << DeclareVarying("texCoord", Shader_Vector2);
|
||||
}
|
||||
|
||||
if (props & ShaderProperties::PerVertexColor)
|
||||
source << DeclareVarying("color", Shader_Vector4);
|
||||
|
||||
// Begin main()
|
||||
source << "\nvoid main(void)\n";
|
||||
source << "{\n";
|
||||
|
||||
if (props & ShaderProperties::HasTexture)
|
||||
source << " gl_FragColor = texture2D(tex, texCoord) * color;\n";
|
||||
else
|
||||
source << " gl_FragColor = color;\n";
|
||||
|
||||
source << "}\n";
|
||||
// End of main()
|
||||
|
||||
DumpFSSource(source);
|
||||
|
||||
GLFragmentShader* fs = nullptr;
|
||||
GLShaderStatus status = GLShaderLoader::CreateFragmentShader(source.str(), &fs);
|
||||
return status == ShaderStatus_OK ? fs : nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
CelestiaGLProgram*
|
||||
ShaderManager::buildProgram(const ShaderProperties& props)
|
||||
{
|
||||
|
@ -3176,12 +3097,7 @@ ShaderManager::buildProgram(const ShaderProperties& props)
|
|||
GLVertexShader* vs = nullptr;
|
||||
GLFragmentShader* fs = nullptr;
|
||||
|
||||
if (props.simpleProps != 0)
|
||||
{
|
||||
vs = buildSimpleVertexShader(props.simpleProps);
|
||||
fs = buildSimpleFragmentShader(props.simpleProps);
|
||||
}
|
||||
else if (props.lightModel == ShaderProperties::RingIllumModel)
|
||||
if (props.lightModel == ShaderProperties::RingIllumModel)
|
||||
{
|
||||
vs = buildRingsVertexShader(props);
|
||||
fs = buildRingsFragmentShader(props);
|
||||
|
@ -3474,11 +3390,6 @@ CelestiaGLProgram::initParameters()
|
|||
{
|
||||
pointScale = floatParam("pointScale");
|
||||
}
|
||||
|
||||
if (props.simpleProps & ShaderProperties::UniformColor)
|
||||
{
|
||||
color = vec4Param("color");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ class ShaderProperties
|
|||
{
|
||||
public:
|
||||
ShaderProperties() = default;
|
||||
ShaderProperties(uint32_t p) : simpleProps(p) {};
|
||||
bool usesShadows() const;
|
||||
bool usesFragmentLighting() const;
|
||||
bool usesTangentSpaceLighting() const;
|
||||
|
@ -91,13 +90,6 @@ class ShaderProperties
|
|||
VolumetricEmissionEffect = 0x0004,
|
||||
};
|
||||
|
||||
enum : uint32_t
|
||||
{
|
||||
UniformColor = 0x0001,
|
||||
PerVertexColor = 0x0002,
|
||||
HasTexture = 0x0004
|
||||
};
|
||||
|
||||
public:
|
||||
unsigned short nLights{ 0 };
|
||||
unsigned short texUsage{ 0 };
|
||||
|
@ -114,9 +106,6 @@ class ShaderProperties
|
|||
// Bit 4, on for cloud shadows
|
||||
uint32_t shadowCounts{ 0 };
|
||||
|
||||
// Properties of "simple" shaders. Other properties are ignored.
|
||||
uint32_t simpleProps{ 0 };
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
|
@ -309,9 +298,6 @@ class ShaderManager
|
|||
GLVertexShader* buildParticleVertexShader(const ShaderProperties&);
|
||||
GLFragmentShader* buildParticleFragmentShader(const ShaderProperties&);
|
||||
|
||||
GLVertexShader* buildSimpleVertexShader(uint32_t);
|
||||
GLFragmentShader* buildSimpleFragmentShader(uint32_t);
|
||||
|
||||
std::map<ShaderProperties, CelestiaGLProgram*> dynamicShaders;
|
||||
std::map<std::string, CelestiaGLProgram*> staticShaders;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue