All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unitTestHelper.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef HD_UNIT_TEST_HELPER
25 #define HD_UNIT_TEST_HELPER
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/engine.h"
29 #include "pxr/imaging/hd/renderPass.h"
30 #include "pxr/imaging/hd/renderPassState.h"
31 #include "pxr/imaging/hd/unitTestDelegate.h"
32 #include "pxr/imaging/hd/unitTestNullRenderDelegate.h"
33 
34 #include "pxr/base/gf/vec4d.h"
35 #include "pxr/base/gf/matrix4d.h"
36 
37 #include <vector>
38 #include <boost/scoped_ptr.hpp>
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 
51 class Hd_TestDriver final {
52 public:
53  Hd_TestDriver();
54  Hd_TestDriver(HdReprSelector const &reprToken);
55  ~Hd_TestDriver();
56 
58  void Draw(bool withGuides=false);
59 
61  void Draw(HdRenderPassSharedPtr const &renderPass, bool withGuides);
62 
64  void SetCamera(GfMatrix4d const &modelViewMatrix,
65  GfMatrix4d const &projectionMatrix,
66  GfVec4d const &viewport);
67 
69  void SetCullStyle(HdCullStyle cullStyle);
70 
72  HdRenderPassSharedPtr const &GetRenderPass();
73 
75  HdRenderPassStateSharedPtr const &GetRenderPassState() const {
76  return _renderPassState;
77  }
78 
80  HdUnitTestDelegate& GetDelegate() { return *_sceneDelegate; }
81 
83  void SetRepr(HdReprSelector const &reprSelector);
84 
85 private:
86 
87  void _Init(HdReprSelector const &reprSelector);
88 
89  HdEngine _engine;
90  Hd_UnitTestNullRenderDelegate _renderDelegate;
91  HdRenderIndex *_renderIndex;
92  HdUnitTestDelegate *_sceneDelegate;
93  SdfPath _cameraId;
94  HdRenderPassSharedPtr _renderPass;
95  HdRenderPassStateSharedPtr _renderPassState;
96  HdRprimCollection _collection;
97 };
98 
99 PXR_NAMESPACE_CLOSE_SCOPE
100 
101 #endif // HD_UNIT_TEST_HELPER
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:119
Basic type for a vector of 4 double components.
Definition: vec4d.h:63
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
The application-facing entry point top-level entry point for accessing Hydra.
Definition: engine.h:48
A named, semantic collection of objects.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
Describes one or more authored display representations for an rprim.
Definition: repr.h:48
A simple delegate class for unit test driver.