mipmap sampling fix

This commit is contained in:
Jack Andersen 2016-02-16 09:42:24 -10:00
parent 7cd035c88c
commit 721929e4d0
6 changed files with 21 additions and 11 deletions

View File

@ -232,6 +232,7 @@ bool ViewManager::proc()
void ViewManager::stop() void ViewManager::stop()
{ {
pshag::CElementGen::Shutdown();
m_mainWindow->getCommandQueue()->stopRenderer(); m_mainWindow->getCommandQueue()->stopRenderer();
} }

View File

@ -194,6 +194,11 @@ void CElementGenShaders::Initialize()
m_gfxToken = CGraphics::CommitResources(); m_gfxToken = CGraphics::CommitResources();
} }
void CElementGenShaders::Shutdown()
{
m_gfxToken.doDestroy();
}
struct SParticleInstanceTex struct SParticleInstanceTex
{ {
Zeus::CVector4f pos[4]; Zeus::CVector4f pos[4];
@ -249,6 +254,11 @@ void CElementGen::Initialize()
CElementGenShaders::Initialize(); CElementGenShaders::Initialize();
} }
void CElementGen::Shutdown()
{
CElementGenShaders::Shutdown();
}
CElementGen::CElementGen(const TToken<CGenDescription>& gen, CElementGen::CElementGen(const TToken<CGenDescription>& gen,
EModelOrientationType orientType, EModelOrientationType orientType,
EOptionalSystemFlags flags) EOptionalSystemFlags flags)
@ -1625,7 +1635,8 @@ void CElementGen::RenderParticles()
} }
float size = 0.5f * particle.x2c_lineLengthOrSize; float size = 0.5f * particle.x2c_lineLengthOrSize;
fprintf(stderr, "%p (%f %f %f) %f\n", this, viewPoint.x, viewPoint.y, viewPoint.z, size); size = 0.5f;
fprintf(stderr, "%p (%f %f %f) %f %f\n", this, viewPoint.x, viewPoint.y, viewPoint.z, size, particle.x30_lineWidthOrRota);
if (0.f == particle.x30_lineWidthOrRota) if (0.f == particle.x30_lineWidthOrRota)
{ {
switch (m_shaderClass) switch (m_shaderClass)
@ -1680,6 +1691,7 @@ void CElementGen::RenderParticles()
inst.uvs[1] = {uvs.xMin, uvs.yMax}; inst.uvs[1] = {uvs.xMin, uvs.yMax};
inst.uvs[2] = {uvs.xMax, uvs.yMin}; inst.uvs[2] = {uvs.xMax, uvs.yMin};
inst.uvs[3] = {uvs.xMin, uvs.yMin}; inst.uvs[3] = {uvs.xMin, uvs.yMin};
fprintf(stderr, "(%f %f) (%f %f)\n", uvs.xMax, uvs.yMax, uvs.xMin, uvs.yMin);
break; break;
} }
case CElementGenShaders::EShaderClass::NoTex: case CElementGenShaders::EShaderClass::NoTex:

View File

@ -171,6 +171,7 @@ public:
static int g_ParticleSystemAliveCount; static int g_ParticleSystemAliveCount;
static bool g_MoveRedToAlphaBuffer; static bool g_MoveRedToAlphaBuffer;
static void Initialize(); static void Initialize();
static void Shutdown();
void SetGeneratorRateScalar(float scalar) void SetGeneratorRateScalar(float scalar)
{ {

View File

@ -68,6 +68,7 @@ public:
#endif #endif
static void Initialize(); static void Initialize();
static void Shutdown();
static EShaderClass GetShaderClass(CElementGen& gen); static EShaderClass GetShaderClass(CElementGen& gen);
static void BuildShaderDataBinding(CElementGen& gen); static void BuildShaderDataBinding(CElementGen& gen);
}; };

View File

@ -9,7 +9,7 @@ static const char* VS_GLSL_TEX =
"#version 330\n" "#version 330\n"
"layout(location=0) in vec4 posIn[4];\n" "layout(location=0) in vec4 posIn[4];\n"
"layout(location=4) in vec4 colorIn;\n" "layout(location=4) in vec4 colorIn;\n"
"layout(location=5) in vec2 uvsIn[4];\n" "layout(location=5) in vec4 uvsIn[4];\n"
"\n" "\n"
"uniform ParticleUniform\n" "uniform ParticleUniform\n"
"{\n" "{\n"
@ -27,7 +27,7 @@ static const char* VS_GLSL_TEX =
"void main()\n" "void main()\n"
"{\n" "{\n"
" vtf.color = colorIn * moduColor;\n" " vtf.color = colorIn * moduColor;\n"
" vtf.uv = uvsIn[gl_VertexID];\n" " vtf.uv = uvsIn[gl_VertexID].xy;\n"
" gl_Position = mvp * posIn[gl_VertexID];\n" " gl_Position = mvp * posIn[gl_VertexID];\n"
" gl_Position = vec4(posIn[gl_VertexID].x, posIn[gl_VertexID].z, 0.0, 1.0);\n" " gl_Position = vec4(posIn[gl_VertexID].x, posIn[gl_VertexID].z, 0.0, 1.0);\n"
"}\n"; "}\n";
@ -46,7 +46,6 @@ static const char* FS_GLSL_TEX =
"void main()\n" "void main()\n"
"{\n" "{\n"
" colorOut = vtf.color * texture(texs[0], vtf.uv);\n" " colorOut = vtf.color * texture(texs[0], vtf.uv);\n"
" colorOut = vtf.color;\n"
"}\n"; "}\n";
static const char* FS_GLSL_TEX_REDTOALPHA = static const char* FS_GLSL_TEX_REDTOALPHA =
@ -64,7 +63,6 @@ static const char* FS_GLSL_TEX_REDTOALPHA =
"{\n" "{\n"
" colorOut = vtf.color * texture(texs[0], vtf.uv);\n" " colorOut = vtf.color * texture(texs[0], vtf.uv);\n"
" colorOut.a = colorOut.r;\n" " colorOut.a = colorOut.r;\n"
" colorOut = vec4(1.0,1.0,1.0,1.0);\n"
"}\n"; "}\n";
static const char* VS_GLSL_INDTEX = static const char* VS_GLSL_INDTEX =
@ -118,7 +116,6 @@ static const char* FS_GLSL_INDTEX =
" vec4 texrTexel = texture(texs[0], vtf.uvTexr);\n" " vec4 texrTexel = texture(texs[0], vtf.uvTexr);\n"
" colorOut = vtf.color * sceneTexel + texrTexel;\n" " colorOut = vtf.color * sceneTexel + texrTexel;\n"
" colorOut.a = vtf.color.a * texrTexel.a;" " colorOut.a = vtf.color.a * texrTexel.a;"
" colorOut = vec4(1.0,1.0,1.0,1.0);\n"
"}\n"; "}\n";
static const char* FS_GLSL_CINDTEX = static const char* FS_GLSL_CINDTEX =
@ -139,7 +136,6 @@ static const char* FS_GLSL_CINDTEX =
" vec2 tindTexel = texture(texs[2], vtf.uvTind).xy;\n" " vec2 tindTexel = texture(texs[2], vtf.uvTind).xy;\n"
" vec4 sceneTexel = texture(texs[1], vtf.uvScene + tindTexel);\n" " vec4 sceneTexel = texture(texs[1], vtf.uvScene + tindTexel);\n"
" colorOut = vtf.color * sceneTexel * texture(texs[0], vtf.uvTexr);\n" " colorOut = vtf.color * sceneTexel * texture(texs[0], vtf.uvTexr);\n"
" colorOut = vec4(1.0,1.0,1.0,1.0);\n"
"}\n"; "}\n";
static const char* VS_GLSL_NOTEX = static const char* VS_GLSL_NOTEX =
@ -177,10 +173,9 @@ static const char* FS_GLSL_NOTEX =
"void main()\n" "void main()\n"
"{\n" "{\n"
" colorOut = vtf.color;\n" " colorOut = vtf.color;\n"
" colorOut = vec4(1.0,1.0,1.0,1.0);\n"
"}\n"; "}\n";
struct MetalDataBindingFactory : CElementGenShaders::IDataBindingFactory struct GLSLDataBindingFactory : CElementGenShaders::IDataBindingFactory
{ {
void BuildShaderDataBinding(CElementGen& gen, void BuildShaderDataBinding(CElementGen& gen,
boo::IShaderPipeline* regPipeline, boo::IShaderPipeline* regPipeline,
@ -336,7 +331,7 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::GLD
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false); false, false, false);
return new struct MetalDataBindingFactory; return new struct GLSLDataBindingFactory;
} }
} }

2
hecl

@ -1 +1 @@
Subproject commit 268a2071b75323022ef4f4cf61f9f8441b6579d2 Subproject commit 82a0c26fd7c1f2acda42c73f4bf4bafbf3281b59