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_FloatArray.h>
23 #include <UT/UT_Matrix4.h>
24 #include <UT/UT_StringHolder.h>
25 #include <UT/UT_UniquePtr.h>
26 #include <UT/UT_ValArray.h>
27 #include <pxr/pxr.h>
28 
29 class UT_JSONWriter;
30 
32 
34 
36 
37 class HUSD_DataHandle;
38 class HUSD_TimeCode;
39 
40 // This class contains content that should be copied to the root layer of a
41 // mirrored HUSD_Datahandle. This is separate from teh HUSD_Overrides session
42 // layers, because those can be enabled or disabled by user preference. The
43 // data in this layer must always exist, and is makes sense to allow it to be
44 // overridden by the data in the HUSD_Overrides, so we put it into the root
45 // layer of the mirrored stage.
46 //
47 // For now this root layer holds the USD camera primitive used when free
48 // tumbling in the viewport. This camera can either be a default camera or
49 // a reference to an existing camera, with modifications to the transforms.
51 {
52 public:
53  HUSD_MirrorRootLayer(const UT_StringRef &freecamsavepath = UT_StringRef());
55 
56  void clear();
57  PXR_NS::XUSD_MirrorRootLayerData &data() const;
58 
60  {
61  public:
63  fpreal myFocalLength = 50.0;
64  fpreal myHAperture = 41.4214;
65  fpreal myHApertureOffset = 0.0;
66  fpreal myVAperture = 41.4214;
67  fpreal myVApertureOffset = 0.0;
68  fpreal myNearClip = 0.1;
69  fpreal myFarClip = 10000.0;
70  bool myIsOrtho = false;
71  bool mySetCamParms = true;
72  bool myDoCamEffects = true;
73  bool mySetCropParms = false;
74  bool myPreserveDepthOfField = false;
75 
76  // We only need to add time sampled transforms if we
77  // are looking through a camera with a render region.
78  // Eventually it would be good for this to go away if the
79  // render region gets implemented as a data window instead
80  // of using the free camera.
83 
84  void dump() const;
85  void dump(UT_JSONWriter &w) const;
86  };
87 
88  // Configure a USD camera primitive for use in the viewport.
89  void createViewportCamera(
90  const HUSD_DataHandle &datahandle,
91  const UT_StringRef &refcamera,
92  const CameraParms &camparms,
93  const HUSD_TimeCode &timecode);
94 
95 private:
97  bool myViewportCameraCreated;
98 };
99 
100 extern HUSD_API size_t
101 format(char *buf, size_t sz, const HUSD_MirrorRootLayer::CameraParms &p);
102 
103 #endif
104 
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
UT_Array< UT_DMatrix4 > myXformSamples
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:1432
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