Skip to content

Commit

Permalink
Lighten back facing, init corrade resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Aug 2, 2021
1 parent 207c53d commit 8ac7da0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NoiseTool/MeshNoisePreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ MeshNoisePreview::VertexColorShader::VertexColorShader()
size_t mainStartIdx = fragShader.find( mainStart );

CORRADE_INTERNAL_ASSERT_OUTPUT( mainStartIdx != std::string::npos );
fragShader.insert( mainStartIdx + mainStart.length(), "if( !gl_FrontFacing ){ fragmentColor = vec4(0.0,0.0,0.0,1.0); return; }" );
fragShader.insert( mainStartIdx + mainStart.length(), "if( !gl_FrontFacing ){ fragmentColor = (1.0 - interpolatedColor) * 0.05; return; }" );

GL::Shader vert = Shaders::Implementation::createCompatibilityShader( rs, version, GL::Shader::Type::Vertex );
GL::Shader frag = Shaders::Implementation::createCompatibilityShader( rs, version, GL::Shader::Type::Fragment );
Expand Down
13 changes: 11 additions & 2 deletions NoiseTool/NoiseToolApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

using namespace Magnum;

void InitResources()
{
#ifdef MAGNUM_BUILD_STATIC
CORRADE_RESOURCE_INITIALIZE( NoiseTool_RESOURCES )
#endif
}

NoiseToolApp::NoiseToolApp( const Arguments& arguments ) :
Platform::Application{ arguments,
Configuration{}
Expand All @@ -20,6 +27,8 @@ NoiseToolApp::NoiseToolApp( const Arguments& arguments ) :
},
mImGuiContext( Vector2{ windowSize() } / dpiScaling(), windowSize(), framebufferSize() )
{
InitResources();

// Add a font that actually looks acceptable on HiDPI screens.
{
ImGui::GetIO().Fonts->Clear();
Expand Down Expand Up @@ -122,11 +131,11 @@ void NoiseToolApp::drawEvent()

cameraVelocity *= mFrameTime.previousFrameDuration() * 80.0f;

if( !cameraVelocity.isZero() ) {
if( !cameraVelocity.isZero() )
{
Matrix4 transform = mCameraObject.transformation();
transform.translation() += transform.rotation() * cameraVelocity;
mCameraObject.setTransformation( transform );
redraw();
}

if( mBackFaceCulling )
Expand Down

0 comments on commit 8ac7da0

Please sign in to comment.