root/OpenSceneGraph/trunk/include/osgWidget/Util @ 9287

Revision 9287, 2.2 kB (checked in by robert, 6 years ago)

From Jeremy Moles, updates to osgWidget

Merged my Robert Osfield from OpenSceneGraph-osgWidget-dev.

RevLine 
[8691]1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under 
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
[9287]14// Code by: Jeremy Moles (cubicool) 2007-2008
[8588]15
16#ifndef OSGWIDGET_UTIL
17#define OSGWIDGET_UTIL
18
[9287]19#include <cctype>
[8588]20#include <algorithm>
21#include <sstream>
22#include <osg/Camera>
23#include <osgViewer/Viewer>
24#include <osgViewer/CompositeViewer>
25
26#include <osgWidget/Export>
27#include <osgWidget/Types>
28
29namespace osgWidget {
30
31// These are NOT OSGWIDGET_EXPORT'd; these are internal only!
32
[8690]33inline std::ostream& _notify(osg::NotifySeverity ns = osg::INFO)
34{
35    std::ostream& n = osg::notify(ns);
36   
37    return n << "osgWidget: ";
[8588]38}
39
[8690]40inline std::ostream& warn()
41{
42    return _notify(osg::WARN);
[8588]43}
44
[8690]45inline std::ostream& info()
46{
47    return _notify();
[8588]48}
49
[8690]50inline std::string lowerCase(const std::string& str)
51{
52    std::string s = str;
[8588]53
[8690]54    // TODO: Why can't I specify std::tolower?
55    std::transform(s.begin(), s.end(), s.begin(), ::tolower);
[8588]56
[8690]57    return s;
[8588]58}
59
60// TODO: Is this totally ghetto or what?
61template <typename T>
[8690]62inline bool hasDecimal(T v)
63{
64    return (v - static_cast<T>(static_cast<long>(v))) > 0.0f;
[8588]65}
66
67class WindowManager;
68
69// These ARE OSGWIDGET_EXPORT'd for your convenience. :)
70
71OSGWIDGET_EXPORT std::string  getFilePath        (const std::string&);
72OSGWIDGET_EXPORT std::string  generateRandomName (const std::string&);
[9287]73OSGWIDGET_EXPORT osg::Camera* createOrthoCamera  (matrix_type, matrix_type);
[8588]74
75// This function sets up our basic example framework, and optionally sets some root
76// scene data.
[9287]77OSGWIDGET_EXPORT int  createExample          (osgViewer::Viewer&, WindowManager*, osg::Node* = 0);
78OSGWIDGET_EXPORT bool writeWindowManagerNode (WindowManager*);
[8588]79
80}
81
82#endif
Note: See TracBrowser for help on using the browser.