1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
46 #include <OpenSG/OSGConfig.h>
47 #include <OpenSG/OSGNode.h>
48 #include <OpenSG/OSGStatCollector.h>
49 #include "TestWindow.h"
55 /*========================== PUBLIC =================================*/
62 // Set up scene characteristics
64 void setScene(NodeBase
&scene
);
66 void setScene(OSG::NodePtr scene
);
68 void setWindow(TestWindow
&win
);
70 void setHeadlight(bool on
);
72 // set near and far, if any <= 0 use showAll() values
73 void setNearFar(OSG::Real32 n
, OSG::Real32 f
);
77 // clear all the animation data
80 // MinTime takes precedence, the path is repeated fully until the time is
83 void setNFrames(OSG::UInt32 nframes
);
84 void setMinTime(OSG::Real32 minTime
);
86 void addFromAtUp(OSG::Real32 fromx
, OSG::Real32 fromy
, OSG::Real32 fromz
,
87 OSG::Real32 atx
, OSG::Real32 aty
, OSG::Real32 atz
,
88 OSG::Real32 upx
, OSG::Real32 upy
, OSG::Real32 upz
);
90 void addFromAtUp(OSG::Pnt3f from
, OSG::Pnt3f at
, OSG::Vec3f up
);
92 // Define Path from VRML-Style Positon/Quaternion Strings
93 void addFromOri(OSG::Char8
*from
, OSG::Char8
*ori
);
95 // Make a rotational path around the whole model
96 void makeOrbit(OSG::Real32 upx
= 0, OSG::Real32 upy
= 1, OSG::Real32 upz
=
99 // Make a pirouette inside the model
100 void makePirouette(OSG::Real32 upx
, OSG::Real32 upy
, OSG::Real32 upz
);
102 // add a FOV to animate
103 void addFov(OSG::Real32 fov
);
107 void setVerbose(bool on
);
109 void useRenderTraversal(bool on
);
111 void setIgnoreGeometry(bool ignore
);
113 void setStatistics(OSG::UInt16 level
);
115 OSG::UInt16
getStatistics(void);
119 Image
snapshot(OSG::UInt32 frame
);
123 OSG::Real32
getFPS(void);
125 OSG::Real32
getTime(void);
127 OSG::UInt32
getNRenderedFrames(void);
129 OSG::Real64
getStatValue(OSG::Char8
*name
, OSG::UInt32 frame
);
132 /*========================= PROTECTED ===============================*/
135 // Expand the data to fit NFrames
136 void expandData(std::vector
<OSG::Matrix
>& views
,
137 std::vector
<OSG::Real32
> &fovs
);
139 void runLoop(std::vector
<OSG::Matrix
> &views
,
140 std::vector
<OSG::Real32
> &fovs
);
142 /*========================== PRIVATE ================================*/
149 OSG::Real32 _near
, _far
;
150 std::vector
<OSG::Pnt3f
> _froms
;
151 std::vector
<OSG::Quaternion
> _oris
;
152 std::vector
<OSG::Real32
> _fovs
;
154 OSG::Real32 _minTime
;
155 OSG::UInt32 _nFrames
;
157 OSG::UInt16 _statsLevel
;
159 bool _useRenderTraversal
;
163 OSG::UInt32 _nRenderedFrames
;
165 std::vector
<OSG::StatCollector
> _stats
;