Skip to content

Instantly share code, notes, and snippets.

@vicrucann
vicrucann / pcl-viewer.cpp
Last active September 15, 2017 18:06
QVTKWidget and depth camera interface running side by side
#include <pcl/PCLGrabber.h>
#include <thread>
#include <mutex>
#include <boost/shared_ptr.hpp>
#include <QApplication>
#include <QMainWindow>
#include <QThread>
#include <QVTKWidget.h>
#include <vtkSmartPointer.h>
@vicrucann
vicrucann / Tube.cpp
Last active April 10, 2017 17:58
Tube tester file
#include "Tube.h"
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/StateSet>
#include <osg/LineWidth>
#include <osg/BlendFunc>
#include <osg/Material>
#include <osg/LightSource>
@vicrucann
vicrucann / glsl.xml
Created February 17, 2017 23:17
GLSL syntax highlighter for Qt Creator
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!-- the version of this file shows the largest supported OpenGL version, second digit is the minor patch level (Y.XP = supports GLSL X.Y0 with patchlevel P -->
<language name="GLSL" section="Sources" extensions="*.glsl;*.vsh;*.vert;*.tcsh;*.tcs;*.tesh;*.tes;*.gsh;*.geo;*.geom;*.fsh;*.frag;*.csh;*.cs" mimetype="text/x-glslsrc" version="4.31" kateversion="2.4" author="Robert Menzel (mail@renderingpipeline.com)" license="LGPL">
<highlighting>
<!-- ####################################################################################################### keywords -->
<list name="keywordsCompatibility">
<!-- compatibility mode, older GLSL versions -->
<item>attribute</item>
@vicrucann
vicrucann / CMakeLists.txt
Created December 13, 2016 15:34
OpeneSceneGraph: using ray casting to perform drawing on 3D virtual plane
cmake_minimum_required(VERSION 2.8.11)
project(osg-raycast)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(OpenSceneGraph REQUIRED COMPONENTS osgDB osgGA osgUtil osgViewer)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
set(SOURCES
@vicrucann
vicrucann / CMakeLists.txt
Created December 13, 2016 15:28
OpenSceneGraph Photo class: photo flips, move and rotation
cmake_minimum_required(VERSION 2.8.11)
project(osg-photo)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(OpenSceneGraph REQUIRED COMPONENTS osgDB osgGA osgUtil osgViewer)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
set(SOURCES
@vicrucann
vicrucann / polygon-fog-shader.cpp
Last active August 3, 2022 08:28
Basic example of a GLSL shader (vertex and fragment shaders) that simulates fog effect; using OpenSceneGraph for visualization
#ifdef _WIN32
#include <Windows.h>
#endif // _WIN32
#include <osg/Camera>
#include <osg/Drawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Group>
#include <osg/Node>
@vicrucann
vicrucann / bezier.frag
Last active February 24, 2024 23:00
GLSL shader that allows to draw smooth and thick Bezier lines in 3D; added fog effect; using OpenSceneGraph for visualization
#version 330
in VertexData{
vec4 mColor;
} VertexIn;
void main(void)
{
gl_FragColor = VertexIn.mColor;
}
@vicrucann
vicrucann / OsgPathFitter.cpp
Last active August 26, 2016 19:50
QtOSG widget displays Bezier curve fitting to data points, based on Schneider's algorithm for curve fitting
#include "OsgPathFitter.h"
template <typename Container, typename Point2, typename Real>
OsgPathFitter<Container, Point2, Real>::OsgPathFitter(const osg::Vec2Array &path)
: PathFitter<osg::Vec2Array, osg::Vec2f, float>(path)
{
}
template <typename Container, typename Point2, typename Real>
Container *OsgPathFitter<Container, Point2, Real>::fit(Real error)
@vicrucann
vicrucann / osg-openGL-version.cpp
Created August 5, 2016 18:27
Obtain OpenGL version from OSG
#include <iostream>
#include <stdio.h>
#ifdef _WIN32
#include <Windows.h>
#endif
#include <osgViewer/Viewer>
#include <osg/GLExtensions>
@vicrucann
vicrucann / osg-shader-polyline2.cpp
Created July 13, 2016 20:09
Similar to the osg-shader-polyline, but with round caps (in development)
#include <Windows.h>
#include <osg/Camera>
#include <osg/Drawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Group>
#include <osg/Node>
#include <osg/NodeVisitor>
#include <osg/Object>