HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OLight.h
Go to the documentation of this file.
1 //-*****************************************************************************
2 //
3 // Copyright (c) 2009-2012,
4 // Sony Pictures Imageworks, Inc. and
5 // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
6 //
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are
11 // met:
12 // * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // * Redistributions in binary form must reproduce the above
15 // copyright notice, this list of conditions and the following disclaimer
16 // in the documentation and/or other materials provided with the
17 // distribution.
18 // * Neither the name of Sony Pictures Imageworks, nor
19 // Industrial Light & Magic nor the names of their contributors may be used
20 // to endorse or promote products derived from this software without specific
21 // prior written permission.
22 //
23 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 //
35 //-*****************************************************************************
36 
37 #ifndef _Alembic_AbcGeom_OLight_h_
38 #define _Alembic_AbcGeom_OLight_h_
39 
40 
41 #include <Alembic/Util/Export.h>
45 
46 namespace Alembic {
47 namespace AbcGeom {
48 namespace ALEMBIC_VERSION_NS {
49 
50 //-*****************************************************************************
51 class ALEMBIC_EXPORT OLightSchema : public Abc::OSchema<LightSchemaInfo>
52 {
53  //-*************************************************************************
54  // LIGHT SCHEMA (just a container schema which has a camera schema)
55  //-*************************************************************************
56 public:
57  //! By convention we always define this_type in AbcGeom classes.
58  //! Used by unspecified-bool-type conversion below
60 
61  //-*************************************************************************
62  // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
63  //-*************************************************************************
64 
65  //! The default constructor creates an empty OLightMeshSchema
66  //! ...
68 
69  //! This templated, primary constructor creates a new camera writer.
70  //! The first argument is any Abc (or AbcCoreAbstract) object
71  //! which can intrusively be converted to an CompoundPropertyWriterPtr
72  //! to use as a parent, from which the error handler policy for
73  //! inheritance is also derived. The remaining optional arguments
74  //! can be used to override the ErrorHandlerPolicy, to specify
75  //! MetaData, and to set TimeSampling.
76  template <class CPROP_PTR>
77  OLightSchema( CPROP_PTR iParent,
78  const std::string &iName,
79  const Abc::Argument &iArg0 = Abc::Argument(),
80  const Abc::Argument &iArg1 = Abc::Argument(),
81  const Abc::Argument &iArg2 = Abc::Argument() )
82  : Abc::OSchema<LightSchemaInfo>( iParent, iName,
83  iArg0, iArg1, iArg2 )
84  {
85 
86  AbcA::TimeSamplingPtr tsPtr =
87  Abc::GetTimeSampling( iArg0, iArg1, iArg2 );
88  uint32_t tsIndex =
89  Abc::GetTimeSamplingIndex( iArg0, iArg1, iArg2 );
90 
91  // if we specified a valid TimeSamplingPtr, use it to determine the
92  // index otherwise we'll use the index, which defaults to the intrinsic
93  // 0 index
94  if (tsPtr)
95  {
96  tsIndex = GetCompoundPropertyWriterPtr( iParent )->getObject(
97  )->getArchive()->addTimeSampling(*tsPtr);
98  m_tsPtr = tsPtr;
99  }
100  else
101  {
102  m_tsPtr = GetCompoundPropertyWriterPtr( iParent )->getObject(
103  )->getArchive()->getTimeSampling( tsIndex );
104  }
105  }
106 
107  template <class CPROP_PTR>
108  explicit OLightSchema( CPROP_PTR iParent,
109  const Abc::Argument &iArg0 = Abc::Argument(),
110  const Abc::Argument &iArg1 = Abc::Argument(),
111  const Abc::Argument &iArg2 = Abc::Argument() )
112  : Abc::OSchema<LightSchemaInfo>( iParent,
113  iArg0, iArg1, iArg2 )
114  {
115 
116  AbcA::TimeSamplingPtr tsPtr =
117  Abc::GetTimeSampling( iArg0, iArg1, iArg2 );
118  uint32_t tsIndex =
119  Abc::GetTimeSamplingIndex( iArg0, iArg1, iArg2 );
120 
121  // if we specified a valid TimeSamplingPtr, use it to determine the
122  // index otherwise we'll use the index, which defaults to the intrinsic
123  // 0 index
124  if (tsPtr)
125  {
126  tsIndex = GetCompoundPropertyWriterPtr( iParent )->getObject(
127  )->getArchive()->addTimeSampling(*tsPtr);
128  m_tsPtr = tsPtr;
129  }
130  else
131  {
132  m_tsPtr = GetCompoundPropertyWriterPtr( iParent )->getObject(
133  )->getArchive()->getTimeSampling( tsIndex );
134  }
135  }
136 
137  //! Copy constructor.
139  : Abc::OSchema<LightSchemaInfo>()
140  {
141  *this = iCopy;
142  }
143 
144  //! Default assignment operator used.
145 
146  //-*************************************************************************
147  // SCHEMA STUFF
148  //-*************************************************************************
149 
150  //! Return the time sampling.
151  AbcA::TimeSamplingPtr getTimeSampling() const { return m_tsPtr; }
152 
153  //-*************************************************************************
154  // SAMPLE STUFF
155  //-*************************************************************************
156 
157  //! All of our properties are not mandatory so we'll just use the
158  //! child bounds.
159  size_t getNumSamples();
160  //! Set a sample
161  void setCameraSample( const CameraSample &iSamp );
162 
163  //! Set from previous sample.
164  void setFromPrevious();
165 
166  void setTimeSampling( uint32_t iIndex );
167  void setTimeSampling( AbcA::TimeSamplingPtr iTime );
168 
169  Abc::OCompoundProperty getUserProperties();
170  Abc::OCompoundProperty getArbGeomParams();
171  Abc::OBox3dProperty getChildBoundsProperty();
172 
173  //-*************************************************************************
174  // ABC BASE MECHANISMS
175  // These functions are used by Abc to deal with errors, validity,
176  // and so on.
177  //-*************************************************************************
178 
179  //! Reset returns this function set to an empty, default
180  //! state.
181  void reset()
182  {
183  m_userProperties.reset();
184  m_arbGeomParams.reset();
185  m_cameraSchema.reset();
186  m_childBoundsProperty.reset();
188  }
189 
190  //! Returns whether this function set is valid.
191  bool valid() const
192  {
194  }
195 
196  //! unspecified-bool-type operator overload.
197  //! ...
199 
200 protected:
201 
203 
205 
208 
210 };
211 
212 //-*****************************************************************************
213 // SCHEMA OBJECT
214 //-*****************************************************************************
216 
217 typedef Util::shared_ptr< OLight > OLightPtr;
218 
219 } // End namespace ALEMBIC_VERSION_NS
220 
221 using namespace ALEMBIC_VERSION_NS;
222 
223 } // End namespace AbcGeom
224 } // End namespace Alembic
225 
226 #endif
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
OLightSchema(const OLightSchema &iCopy)
Copy constructor.
Definition: OLight.h:138
Util::shared_ptr< OLight > OLightPtr
Definition: OLight.h:217
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
OLightSchema(CPROP_PTR iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument(), const Abc::Argument &iArg2=Abc::Argument())
Definition: OLight.h:77
#define ALEMBIC_OVERRIDE_OPERATOR_BOOL(PASS_COND)
Definition: OperatorBool.h:56
OLightSchema(CPROP_PTR iParent, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument(), const Abc::Argument &iArg2=Abc::Argument())
Definition: OLight.h:108
AbcA::TimeSamplingPtr getTimeSampling() const
Default assignment operator used.
Definition: OLight.h:151
Abc::OSchemaObject< OLightSchema > OLight
Definition: OLight.h:215
AbcA::TimeSamplingPtr GetTimeSampling(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition: Argument.h:259
AbcA::CompoundPropertyWriterPtr GetCompoundPropertyWriterPtr(AbcA::CompoundPropertyWriterPtr iPtr)
Definition: Foundation.h:164
#define ALEMBIC_EXPORT
Definition: Export.h:51
uint32_t GetTimeSamplingIndex(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition: Argument.h:272
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:104
bool valid() const
Returns whether this function set is valid.
Definition: OLight.h:191