Skip to content

Instantly share code, notes, and snippets.

/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2014 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@gwaldron
gwaldron / gist:7750ebee8417fc1708b6
Created October 8, 2015 20:12
Use a CullVisitor to collect information about a scene
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@gwaldron
gwaldron / gist:8728f5278de2a6c213a86ba16ecd1f42
Last active March 11, 2021 13:20
GLSL model outline for OSG
#include <osgViewer/Viewer>
#include <osg/Depth>
#include <osg/Program>
#include <osg/Uniform>
#include <osgDB/ReadFile>
int
main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc,argv);
@gwaldron
gwaldron / gist:ad98e47bbc7c746c472cbeb9022c5692
Last active August 31, 2016 17:53
GLSL model outline for osgEarth VP
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@gwaldron
gwaldron / gist:e8e6f418e67e0527c684bfcebed856f1
Last active September 2, 2016 13:22
OE: attribute-less rendering (grass, trees?)
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgEarth/VirtualProgram>
using namespace osgEarth;
struct VirtualDrawable : public osg::Drawable
{
VirtualDrawable()
{
struct OceanLayer : public Layer
{
OceanLayer() : Layer()
{
const char* oceanFS =
"#version 330 \n"
"void oceanFS(inout vec4 color) { \n"
" color = vec4(0.4, 0.4, 0.55, 0.8); \n"
"} \n";
@gwaldron
gwaldron / gist:e33cf72ee78765cbc0a869ad4c9b5142
Created October 31, 2016 13:40
Various GPU pipeline stuff
//
//
// Noise sandbox.
// Run with
// oe r.earth --uniform freq 64 16 --uniform amplitude 1 50 --uniform pers 0.5 0.9 --uniform lac 2.0 3.0 --uniform baseLOD 11 12 --uniform slopeAmp 0 1 --uniform curvatureAmp 0 1 --uniform DD -1 1 --sky --coords --activity
//
//
#include <osgViewer/Viewer>
#include <osgEarth/Notify>
#include <osgEarthUtil/EarthManipulator>
@gwaldron
gwaldron / gist:f1c0f7f976fce8f202c93f07b3a51c08
Created January 20, 2017 15:56
Line of sight without frame loop (#17)
#include <osgEarth/MapNode>
#include <osgEarth/TileKey>
#include <osgEarth/Terrain>
#include <osgEarth/TerrainTileNode>
#include <osgEarth/GeoData>
#include <osgEarth/DPLineSegmentIntersector>
#include <osg/NodeVisitor>
using namespace osgEarth;
@gwaldron
gwaldron / gist:28eee2ec49ab46b95833fc3015b9b306
Last active January 31, 2017 16:03
CacheSettings/FeatureSource hack
#include <osgEarth/Notify>
#include <osgEarth/Cache>
#include <osgEarthFeatures/FeatureSource>
#include <osgEarthDrivers/feature_wfs/WFSFeatureOptions>
using namespace osgEarth;
using namespace osgEarth::Features;
using namespace osgEarth::Drivers;
@gwaldron
gwaldron / gist:2219f5381ceb2fba528b66294a1762dd
Created February 3, 2017 15:31
ReadWriteMutex replacement - Try to make it read-reentrant
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2016 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*