Skip to content

Commit

Permalink
app cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Jun 6, 2024
1 parent 09ddf84 commit a983110
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/applications/osgearth_imgui/osgearth_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ main(int argc, char** argv)
// through to other handlers.
viewer.getEventHandlers().push_front(new GUI::ApplicationGUI(arguments, true));
viewer.setSceneData(node);
node = nullptr;
return Metrics::run(viewer);
}
else
Expand Down
25 changes: 6 additions & 19 deletions src/applications/osgearth_viewer/osgearth_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@
*/

#include <osgViewer/Viewer>
#include <osgEarth/Notify>
#include <osgEarth/EarthManipulator>
#include <osgEarth/ExampleResources>
#include <osgEarth/MapNode>
#include <osgEarth/Threading>
#include <osgEarth/ShaderGenerator>
#include <osgEarth/PhongLightingEffect>
#include <osgDB/ReadFile>
#include <osgGA/TrackballManipulator>
#include <osgUtil/Optimizer>
#include <iostream>

#include <osgEarth/Metrics>
Expand All @@ -43,9 +38,9 @@ using namespace osgEarth::Util;
int
usage(const char* name)
{
OE_NOTICE
std::cout
<< "\nUsage: " << name << " file.earth" << std::endl
<< MapNodeHelper().usage() << std::endl;
<< Util::MapNodeHelper().usage() << std::endl;

return 0;
}
Expand All @@ -58,24 +53,16 @@ main(int argc, char** argv)
if ( arguments.read("--help") )
return usage(argv[0]);

// start up osgEarth
osgEarth::initialize(arguments);

// create a viewer:
// create a simple view
osgViewer::Viewer viewer(arguments);
// This is normally called by Viewer::run but we are running our frame loop manually so we need to call it here.
viewer.setReleaseContextAtEndOfFrameHint(false);

// Tell the database pager to not modify the unref settings
viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, false );

// thread-safe initialization of the OSG wrapper manager. Calling this here
// prevents the "unsupported wrapper" messages from OSG
osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper("osg::Image");

// install our default manipulator (do this before calling load)
viewer.setCameraManipulator( new EarthManipulator(arguments) );
viewer.setCameraManipulator(new EarthManipulator(arguments));

// disable the small-feature culling
// disable the small-feature culling; necessary for some feature rendering
viewer.getCamera()->setSmallFeatureCullingPixelSize(-1.0f);

// load an earth file, and support all or our example command-line options
Expand Down
8 changes: 6 additions & 2 deletions src/osgEarth/ImGui/RenderingGUI
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ void oeui_render_winding_fs(inout vec4 color) {
#version 450
#extension GL_NV_fragment_shader_barycentric : enable
#pragma vp_function oeui_render_outlines, fragment_lighting, last
#define VP_STAGE_FRAGMENT
void oeui_render_outlines(inout vec4 color) {
float b = min(gl_BaryCoordNV.x, min(gl_BaryCoordNV.y, gl_BaryCoordNV.z))*28.0;
vec3 line_color = (vec3(1.0)-color.rgb); //clamp(color.rgb*1.5, 0.0, 1.0);
float b = min(gl_BaryCoordNV.x, min(gl_BaryCoordNV.y, gl_BaryCoordNV.z))*32.0;
vec3 line_color = color.rgb;
if (color.r < 0.5) line_color.r += 0.5; else line_color.r -= 0.5;
if (color.b < 0.5) line_color.b += 0.5; else line_color.b -= 0.5;
if (color.g < 0.5) line_color.b += 0.5; else line_color.g -= 0.5;
color = vec4(mix(line_color, color.rgb, clamp(b,0,1)), color.a);
}
)";
Expand Down

0 comments on commit a983110

Please sign in to comment.