All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utils.h
Go to the documentation of this file.
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 PXVP20_UTILS_H
25 #define PXVP20_UTILS_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "px_vp20/api.h"
31 
32 #include "pxr/base/gf/matrix4d.h"
33 #include "pxr/base/gf/matrix4f.h"
34 #include "pxr/base/gf/vec4f.h"
35 #include "pxr/imaging/glf/simpleLightingContext.h"
36 
37 #include <maya/M3dView.h>
38 #include <maya/MBoundingBox.h>
39 #include <maya/MDrawContext.h>
40 #include <maya/MHWGeometryUtilities.h>
41 #include <maya/MMatrix.h>
42 #include <maya/MSelectionContext.h>
43 
44 #include <ostream>
45 
46 
47 PXR_NAMESPACE_OPEN_SCOPE
48 
49 
50 class px_vp20Utils
51 {
52  public:
54  PX_VP20_API
55  static bool setupLightingGL(const MHWRender::MDrawContext& context);
56  PX_VP20_API
57  static void unsetLightingGL(const MHWRender::MDrawContext& context);
58 
60  PX_VP20_API
61  static GlfSimpleLightingContextRefPtr GetLightingContextFromDrawContext(
62  const MHWRender::MDrawContext& context);
63 
70  PX_VP20_API
71  static bool GetViewFromDrawContext(
72  const MHWRender::MDrawContext& context,
73  M3dView& view);
74 
76  PX_VP20_API
77  static bool RenderBoundingBox(
78  const MBoundingBox& bounds,
79  const GfVec4f& color,
80  const MMatrix& worldViewMat,
81  const MMatrix& projectionMat);
82 
87  PX_VP20_API
88  static bool RenderWireCubes(
89  const std::vector<GfMatrix4f>& cubeXforms,
90  const GfVec4f& color,
91  const GfMatrix4d& worldViewMat,
92  const GfMatrix4d& projectionMat);
93 
96  PX_VP20_API
97  static bool GetSelectionMatrices(
98  const MHWRender::MSelectionInfo& selectionInfo,
99  const MHWRender::MDrawContext& context,
100  GfMatrix4d& viewMatrix,
101  GfMatrix4d& projectionMatrix);
102 
108  PX_VP20_API
109  static void OutputDisplayStyleToStream(
110  const unsigned int displayStyle,
111  std::ostream& stream);
112 
115  PX_VP20_API
116  static void OutputDisplayStatusToStream(
117  const MHWRender::DisplayStatus displayStatus,
118  std::ostream& stream);
119 
120  private:
121  px_vp20Utils() = delete;
122  ~px_vp20Utils() = delete;
123 };
124 
125 
126 PXR_NAMESPACE_CLOSE_SCOPE
127 
128 
129 #endif
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Basic type for a vector of 4 float components.
Definition: vec4f.h:63