root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osg/OcclusionQueryNode.cpp @ 13041

Revision 13041, 2.7 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1//
2// Copyright (C) 2007 Skew Matrix Software LLC (http://www.skew-matrix.com)
3//
4// This library is open source and may be redistributed and/or modified under
5// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6// (at your option) any later version.  The full license is in LICENSE file
7// included with this distribution, and on the openscenegraph.org website.
8//
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// OpenSceneGraph Public License for more details.
13//
14
15#include <osg/OcclusionQueryNode>
16
17#include <iostream>
18#include <sstream>
19#include <string>
20
21#include <osg/io_utils>
22
23#include <osgDB/Registry>
24#include <osgDB/Input>
25#include <osgDB/Output>
26#include <osgDB/ParameterOutput>
27
28bool OQN_readLocalData( osg::Object &obj, osgDB::Input &fr );
29bool OQN_writeLocalData( const osg::Object &obj, osgDB::Output &fw );
30
31REGISTER_DOTOSGWRAPPER(OcclusionQueryNode)
32(
33    new osg::OcclusionQueryNode,
34    "OcclusionQueryNode",
35    "Object Node OcclusionQueryNode Group",
36    OQN_readLocalData,
37    OQN_writeLocalData
38);
39
40bool OQN_readLocalData( osg::Object &obj, osgDB::Input &fr )
41{
42    osg::OcclusionQueryNode& oqn = static_cast<osg::OcclusionQueryNode&>( obj );
43    bool advanced( false );
44    int param;
45    if (fr[0].matchWord( "QueriesEnabled" ))
46    {
47        bool enable( fr[1].getStr() == std::string("TRUE") );
48        oqn.setQueriesEnabled( enable );
49        fr+=2;
50        advanced = true;
51    }
52    if (fr.matchSequence( "VisibilityThreshold %i" ))
53    {
54        fr[1].getInt( param );
55        oqn.setVisibilityThreshold( param );
56        fr+=2;
57        advanced = true;
58    }
59    if (fr.matchSequence( "QueryFrameCount %i" ))
60    {
61        fr[1].getInt( param );
62        oqn.setQueryFrameCount( param );
63        fr+=2;
64        advanced = true;
65    }
66    if (fr[0].matchWord( "DebugDisplay" ))
67    {
68        bool enable( fr[1].getStr() == std::string("TRUE") );
69        oqn.setDebugDisplay( enable );
70        fr+=2;
71        advanced = true;
72    }
73
74    return advanced;
75}
76
77bool OQN_writeLocalData( const osg::Object &obj, osgDB::Output &fw )
78{
79    const osg::OcclusionQueryNode& oqn = static_cast<const osg::OcclusionQueryNode&>( obj );
80
81    //fw.writeObject( oqn.getOQN(i));
82
83    fw.indent() << "QueriesEnabled " <<
84        (oqn.getQueriesEnabled() ? "TRUE" : "FALSE")
85        << std::endl;
86    fw.indent() << "VisibilityThreshold " <<
87        oqn.getVisibilityThreshold() << std::endl;
88    fw.indent() << "QueryFrameCount " <<
89        oqn.getQueryFrameCount() << std::endl;
90    fw.indent() << "DebugDisplay " <<
91        (oqn.getDebugDisplay() ? "TRUE" : "FALSE")
92        << std::endl;
93
94    return true;
95}
Note: See TracBrowser for help on using the browser.