All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hdRenderer.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 PXRUSDMAYAGL_HD_RENDERER_H
25 #define PXRUSDMAYAGL_HD_RENDERER_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxrUsdMayaGL/api.h"
31 
32 #include "pxr/base/gf/vec3d.h"
33 #include "pxr/base/gf/vec4f.h"
34 #include "pxr/usd/sdf/path.h"
35 #include "pxr/usd/usd/prim.h"
36 #include "pxr/usdImaging/usdImagingGL/engine.h"
37 
38 #include <maya/M3dView.h>
39 #include <maya/MBoundingBox.h>
40 #include <maya/MColor.h>
41 #include <maya/MDagPath.h>
42 #include <maya/MDrawRequest.h>
43 #include <maya/MDrawContext.h>
44 #include <maya/MFrameContext.h>
45 #include <maya/MSelectInfo.h>
46 
47 #include <memory>
48 #include <vector>
49 
50 
51 PXR_NAMESPACE_OPEN_SCOPE
52 
53 
101 {
102 public:
103 
107  DRAW_POINTS,
108  DRAW_WIREFRAME,
109  DRAW_SHADED_FLAT,
110  DRAW_SHADED_SMOOTH,
111  DRAW_BOUNDING_BOX
112  };
113 
116  struct RequestData {
117  GfVec4f fWireframeColor;
118  MBoundingBox bounds;
119  MDrawRequest drawRequest;
120  };
121  typedef std::vector<RequestData> RequestDataArray;
122 
125  PXRUSDMAYAGL_API
126  void CheckRendererSetup(
127  const UsdPrim& usdPrim,
128  const SdfPathVector& excludePaths);
129 
132  PXRUSDMAYAGL_API
134  const MDagPath& objPath,
135  const MHWRender::MFrameContext& frameContext,
136  const MBoundingBox& bounds,
137  UsdMayaGLHdRenderer::RequestDataArray *requestArray);
142  PXRUSDMAYAGL_API
143  void Render(
144  const MDrawRequest& aRequest,
145  M3dView& aView,
146  UsdImagingGLRenderParams params) const;
147 
153  PXRUSDMAYAGL_API
154  void RenderVp2(
155  const RequestDataArray &requests,
156  const MHWRender::MDrawContext& context,
157  UsdImagingGLRenderParams params) const;
158 
160  PXRUSDMAYAGL_API
161  bool TestIntersection(
162  MSelectInfo& selectInfo,
164  GfVec3d* hitPoint) const;
165 
168  PXRUSDMAYAGL_API
169  static float SubdLevelToComplexity(int subdLevel);
170 
171 private:
172  UsdPrim _renderedPrim;
173  SdfPathVector _excludePrimPaths;
174  std::unique_ptr<UsdImagingGLEngine> _renderer;
175 };
176 
177 
178 PXR_NAMESPACE_CLOSE_SCOPE
179 
180 
181 #endif
struct to hold all the information needed for a viewport 2.0 draw request.
Definition: hdRenderer.h:116
DRAWING_STYLES
Enum for various drawing styles.
Definition: hdRenderer.h:106
PXRUSDMAYAGL_API bool TestIntersection(MSelectInfo &selectInfo, UsdImagingGLRenderParams params, GfVec3d *hitPoint) const
Test for intersection, for use in select().
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
PXRUSDMAYAGL_API void Render(const MDrawRequest &aRequest, M3dView &aView, UsdImagingGLRenderParams params) const
Render the USD.
Basic type for a vector of 4 float components.
Definition: vec4f.h:63
Used as an arguments class for various methods in UsdImagingGLEngine.
Definition: renderParams.h:72
PXRUSDMAYAGL_API void RenderVp2(const RequestDataArray &requests, const MHWRender::MDrawContext &context, UsdImagingGLRenderParams params) const
Render the array of draw requests in viewport 2.0.
Basic type for a vector of 3 double components.
Definition: vec3d.h:63
PXRUSDMAYAGL_API void GenerateDefaultVp2DrawRequests(const MDagPath &objPath, const MHWRender::MFrameContext &frameContext, const MBoundingBox &bounds, UsdMayaGLHdRenderer::RequestDataArray *requestArray)
Generate an array of draw requests based on the selection status of objPath.
Simple implementation of a Hydra renderer for a Maya shape.
Definition: hdRenderer.h:100
static PXRUSDMAYAGL_API float SubdLevelToComplexity(int subdLevel)
Helper function to convert from subdLevel (int) into Hydra&#39;s complexity parameter (float) ...
PXRUSDMAYAGL_API void CheckRendererSetup(const UsdPrim &usdPrim, const SdfPathVector &excludePaths)
Should be called when the prim to usdPrim to draw or excludePaths change.