mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Translucent mesh sorting fixes and improvements.
This commit is contained in:
parent
8cfddcefa3
commit
081373742e
4 changed files with 14 additions and 5 deletions
|
@ -45,7 +45,7 @@ void lcScene::End()
|
||||||
|
|
||||||
auto TranslucentMeshCompare = [this](int Index1, int Index2)
|
auto TranslucentMeshCompare = [this](int Index1, int Index2)
|
||||||
{
|
{
|
||||||
return mRenderMeshes[Index1].Distance < mRenderMeshes[Index2].Distance;
|
return mRenderMeshes[Index1].Distance > mRenderMeshes[Index2].Distance;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::sort(mTranslucentMeshes.begin(), mTranslucentMeshes.end(), TranslucentMeshCompare);
|
std::sort(mTranslucentMeshes.begin(), mTranslucentMeshes.end(), TranslucentMeshCompare);
|
||||||
|
|
|
@ -27,6 +27,11 @@ public:
|
||||||
return mActiveSubmodelInstance;
|
return mActiveSubmodelInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const lcMatrix44& GetViewMatrix() const
|
||||||
|
{
|
||||||
|
return mViewMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
void SetDrawInterface(bool DrawInterface)
|
void SetDrawInterface(bool DrawInterface)
|
||||||
{
|
{
|
||||||
mDrawInterface = DrawInterface;
|
mDrawInterface = DrawInterface;
|
||||||
|
|
|
@ -874,6 +874,12 @@ void View::OnDraw()
|
||||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DrawInterface)
|
||||||
|
{
|
||||||
|
mContext->SetViewMatrix(mScene.GetViewMatrix());
|
||||||
|
DrawGrid();
|
||||||
|
}
|
||||||
|
|
||||||
mContext->SetLineWidth(Preferences.mLineWidth);
|
mContext->SetLineWidth(Preferences.mLineWidth);
|
||||||
|
|
||||||
mScene.Draw(mContext);
|
mScene.Draw(mContext);
|
||||||
|
@ -912,8 +918,6 @@ void View::OnDraw()
|
||||||
|
|
||||||
mContext->SetLineWidth(1.0f);
|
mContext->SetLineWidth(1.0f);
|
||||||
|
|
||||||
DrawGrid();
|
|
||||||
|
|
||||||
if (Preferences.mDrawAxes)
|
if (Preferences.mDrawAxes)
|
||||||
DrawAxes();
|
DrawAxes();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@ void main()
|
||||||
{
|
{
|
||||||
LC_PIXEL_FAKE_LIGHTING
|
LC_PIXEL_FAKE_LIGHTING
|
||||||
LC_SHADER_PRECISION vec4 TexelColor = texture2D(Texture, PixelTexCoord);
|
LC_SHADER_PRECISION vec4 TexelColor = texture2D(Texture, PixelTexCoord);
|
||||||
LC_SHADER_PRECISION vec4 DiffuseColor = mix(MaterialColor, TexelColor, TexelColor.a);
|
LC_SHADER_PRECISION vec3 DiffuseColor = mix(MaterialColor.rgb, TexelColor.rgb, TexelColor.a);
|
||||||
gl_FragColor = vec4(vec3(DiffuseColor) * Diffuse + SpecularColor, DiffuseColor.a);
|
gl_FragColor = vec4(DiffuseColor * Diffuse + SpecularColor, max(TexelColor.a, MaterialColor.a));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue