OpenSceneGraph 3.6.5
Util
Go to the documentation of this file.
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
14// Code by: Jeremy Moles (cubicool) 2007-2008
15
16#ifndef OSGWIDGET_UTIL
17#define OSGWIDGET_UTIL
18
19#include <ctype.h>
20#include <cctype>
21#include <algorithm>
22#include <sstream>
23#include <osg/Camera>
24#include <osgViewer/Viewer>
26
27#include <osgWidget/Export>
28#include <osgWidget/Types>
29
30namespace osgWidget {
31
32// These are NOT OSGWIDGET_EXPORT'd; these are internal only!
33
34inline std::ostream& _notify(osg::NotifySeverity ns = osg::INFO)
35{
36 std::ostream& n = osg::notify(ns);
37
38 return n << "osgWidget: ";
39}
40
41inline std::ostream& warn()
42{
43 return _notify(osg::WARN);
44}
45
46inline std::ostream& info()
47{
48 return _notify();
49}
50
51inline char lowerCaseChar(const char in)
52{
53 return (unsigned char)(::tolower((int)((unsigned char)in)));
54}
55
56inline std::string lowerCase(const std::string& str)
57{
58 std::string s = str;
59
60 // TODO: Why can't I specify std::tolower?
61 std::transform(s.begin(), s.end(), s.begin(), lowerCaseChar);
62
63 return s;
64}
65
66// TODO: Is this totally ghetto or what?
67template <typename T>
68inline bool hasDecimal(T v)
69{
70 return (v - static_cast<T>(static_cast<long>(v))) > 0.0f;
71}
72
73class WindowManager;
74
75// These ARE OSGWIDGET_EXPORT'd for your convenience. :)
76
77OSGWIDGET_EXPORT std::string getFilePath (const std::string&);
78OSGWIDGET_EXPORT std::string generateRandomName (const std::string&);
80
81// This function sets up our basic example framework, and optionally sets some root
82// scene data.
85
86}
87
88#endif
NotifySeverity
Range of notify levels from DEBUG_FP through to FATAL, ALWAYS is reserved for forcing the absorption ...
Definition Notify:30
@ WARN
Definition Notify:33
@ INFO
Definition Notify:35
std::ostream & notify(void)
Definition Notify:80
The osgWidget library is a NodeKit that extends the core scene graph to support a 2D (and eventually ...
Definition Box:21
std::string lowerCase(const std::string &str)
Definition Util:56
OSGWIDGET_EXPORT int createExample(osgViewer::Viewer &, WindowManager *, osg::Node *=0)
bool hasDecimal(T v)
Definition Util:68
OSGWIDGET_EXPORT bool writeWindowManagerNode(WindowManager *)
std::ostream & _notify(osg::NotifySeverity ns=osg::INFO)
Definition Util:34
std::ostream & warn()
Definition Util:41
OSGWIDGET_EXPORT osg::Camera * createOrthoCamera(matrix_type, matrix_type)
OSGWIDGET_EXPORT std::string generateRandomName(const std::string &)
char lowerCaseChar(const char in)
Definition Util:51
osg::Matrix::value_type matrix_type
Definition Types:39
std::ostream & info()
Definition Util:46
OSGWIDGET_EXPORT std::string getFilePath(const std::string &)
Camera - is a subclass of Transform which represents encapsulates the settings of a Camera.
Definition Camera:45
Base class for all internal nodes in the scene graph.
Definition Node:72
Viewer holds a single view on to a single scene.
Definition Viewer:28
Definition WindowManager:39
#define OSGWIDGET_EXPORT
Definition Export:42

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.