Commit 7009ff78 authored by Jordon Moss's avatar Jordon Moss
Browse files

engine: Add linear sampler object, fixes forcefilter DEF token in polymost.

parent dc16f81b
......@@ -33,6 +33,8 @@ enum glsamplertype
SAMPLER_NONE,
SAMPLER_NEAREST_CLAMP,
SAMPLER_NEAREST_WRAP,
SAMPLER_LINEAR_CLAMP,
SAMPLER_LINEAR_WRAP,
SAMPLER_CLAMP,
SAMPLER_WRAP_T,
SAMPLER_WRAP_S,
......
......@@ -218,6 +218,16 @@ void buildgl_resetSamplerObjects(void)
glSamplerParameteri(s, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glSamplerParameteri(s, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1);
s = samplerObjectIDs[SAMPLER_LINEAR_CLAMP];
glSamplerParameteri(s, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glSamplerParameteri(s, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glSamplerParameteri(s, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(s, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
s = samplerObjectIDs[SAMPLER_LINEAR_WRAP];
glSamplerParameteri(s, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glSamplerParameteri(s, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
s = samplerObjectIDs[SAMPLER_DEPTH];
glSamplerParameteri(s, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
glSamplerParameteri(s, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
......@@ -234,7 +244,7 @@ void buildgl_bindSamplerObject(int texunit, int32_t pth_method)
glsamplertype samplerid = SAMPLER_NEAREST_WRAP;
switch (pth_method & (PTH_INDEXED|PTH_CLAMPED|PTH_HIGHTILE|PTH_TEMP_SKY_HACK|PTH_DEPTH_SAMPLER))
switch (pth_method & (PTH_INDEXED|PTH_CLAMPED|PTH_HIGHTILE|PTH_FORCEFILTER|PTH_TEMP_SKY_HACK|PTH_DEPTH_SAMPLER))
{
case PTH_DEPTH_SAMPLER:
samplerid = SAMPLER_DEPTH;
......@@ -255,6 +265,12 @@ void buildgl_bindSamplerObject(int texunit, int32_t pth_method)
case PTH_HIGHTILE|PTH_CLAMPED:
samplerid = SAMPLER_CLAMP;
break;
case PTH_HIGHTILE|PTH_FORCEFILTER:
samplerid = SAMPLER_LINEAR_WRAP;
break;
case PTH_HIGHTILE|PTH_FORCEFILTER|PTH_CLAMPED:
samplerid = SAMPLER_LINEAR_CLAMP;
break;
case 0:
samplerid = SAMPLER_NONE;
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment