HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_MirrorRootLayer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_MirrorRootLayer_h__
19 #define __HUSD_MirrorRootLayer_h__
20 
21 #include "HUSD_API.h"
22 #include <UT/UT_Matrix4.h>
23 #include <UT/UT_StringHolder.h>
24 #include <UT/UT_UniquePtr.h>
25 #include <pxr/pxr.h>
26 
27 class UT_JSONWriter;
28 
30 
32 
34 
35 class HUSD_DataHandle;
36 class HUSD_TimeCode;
37 
38 // This class contains content that should be copied to the root layer of a
39 // mirrored HUSD_Datahandle. This is separate from teh HUSD_Overrides session
40 // layers, because those can be enabled or disabled by user preference. The
41 // data in this layer must always exist, and is makes sense to allow it to be
42 // overridden by the data in the HUSD_Overrides, so we put it into the root
43 // layer of the mirrored stage.
44 //
45 // For now this root layer holds the USD camera primitive used when free
46 // tumbling in the viewport. This camera can either be a default camera or
47 // a reference to an existing camera, with modifications to the transforms.
49 {
50 public:
51  HUSD_MirrorRootLayer(const UT_StringRef &freecamsavepath = UT_StringRef());
53 
54  void clear();
55  PXR_NS::XUSD_MirrorRootLayerData &data() const;
56 
58  {
59  public:
61  fpreal myFocalLength = 50.0;
62  fpreal myHAperture = 41.4214;
63  fpreal myHApertureOffset = 0.0;
64  fpreal myVAperture = 41.4214;
65  fpreal myVApertureOffset = 0.0;
66  fpreal myNearClip = 0.1;
67  fpreal myFarClip = 10000.0;
68  bool myIsOrtho = false;
69  bool mySetCamParms = true;
70  bool myDoCamEffects = true;
71  bool mySetCropParms = false;
72 
73  void dump() const;
74  void dump(UT_JSONWriter &w) const;
75  };
76 
77  // Configure a USD camera primitive for use in the viewport.
78  void createViewportCamera(
79  const HUSD_DataHandle &datahandle,
80  const UT_StringRef &refcamera,
81  const CameraParms &camparms,
82  const HUSD_TimeCode &timecode);
83 
84 private:
86  bool myViewportCameraCreated;
87 };
88 
89 extern HUSD_API size_t
90 format(char *buf, size_t sz, const HUSD_MirrorRootLayer::CameraParms &p);
91 
92 #endif
93 
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
GLboolean * data
Definition: glcorearb.h:131
#define HUSD_API
Definition: HUSD_API.h:32
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
HUSD_API size_t format(char *buf, size_t sz, const HUSD_MirrorRootLayer::CameraParms &p)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
fpreal64 fpreal
Definition: SYS_Types.h:277
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857