/src/alembic/lib/Alembic/AbcGeom/ILight.h
Line | Count | Source |
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_ILight_h |
38 | | #define Alembic_AbcGeom_ILight_h |
39 | | |
40 | | #include <Alembic/Util/Export.h> |
41 | | #include <Alembic/AbcGeom/ICamera.h> |
42 | | #include <Alembic/AbcGeom/Foundation.h> |
43 | | #include <Alembic/AbcGeom/SchemaInfoDeclarations.h> |
44 | | |
45 | | namespace Alembic { |
46 | | namespace AbcGeom { |
47 | | namespace ALEMBIC_VERSION_NS { |
48 | | |
49 | | //-***************************************************************************** |
50 | | class ALEMBIC_EXPORT ILightSchema : public Abc::ISchema<LightSchemaInfo> |
51 | | { |
52 | | //-************************************************************************* |
53 | | // LIGHT SCHEMA (container schema which has a camera schema) |
54 | | //-************************************************************************* |
55 | | public: |
56 | | //! By convention we always define this_type in AbcGeom classes. |
57 | | //! Used by unspecified-bool-type conversion below |
58 | | typedef ILightSchema this_type; |
59 | | |
60 | | //-************************************************************************* |
61 | | // CONSTRUCTION, DESTRUCTION, ASSIGNMENT |
62 | | //-************************************************************************* |
63 | | |
64 | | //! The default constructor creates an empty OLightMeshSchema |
65 | | //! ... |
66 | 0 | ILightSchema() {} |
67 | | |
68 | | //! This constructor creates a new light reader. |
69 | | //! The first argument is the parent ICompoundProperty, from which the |
70 | | //! error handler policy for is derived. The second argument is the name |
71 | | //! of the ICompoundProperty that contains this schemas properties. The |
72 | | //! remaining optional arguments can be used to override the |
73 | | //! ErrorHandlerPolicy and to specify schema interpretation matching. |
74 | | ILightSchema( const ICompoundProperty &iParent, |
75 | | const std::string &iName, |
76 | | const Abc::Argument &iArg0 = Abc::Argument(), |
77 | | const Abc::Argument &iArg1 = Abc::Argument() ) |
78 | | : Abc::ISchema<LightSchemaInfo>( iParent, iName, iArg0, iArg1 ) |
79 | 0 | { |
80 | 0 | init( iArg0, iArg1 ); |
81 | 0 | } |
82 | | |
83 | | //! This constructor wraps an existing ICompoundProperty as the faceset |
84 | | //! reader, and the error handler policy is derived from it. |
85 | | //! The remaining optional arguments can be used to override the |
86 | | //! ErrorHandlerPolicy and to specify schema interpretation matching. |
87 | | explicit ILightSchema( const ICompoundProperty &iProp, |
88 | | const Abc::Argument &iArg0 = Abc::Argument(), |
89 | | const Abc::Argument &iArg1 = Abc::Argument() ) |
90 | | : Abc::ISchema<LightSchemaInfo>( iProp, iArg0, iArg1 ) |
91 | 0 | { |
92 | 0 | init( iArg0, iArg1 ); |
93 | 0 | } |
94 | | |
95 | | //! Access to the camera schema. |
96 | 0 | ICameraSchema getCameraSchema() const { return m_cameraSchema; } |
97 | | |
98 | | //! Access to the child bounds property |
99 | | Abc::IBox3dProperty getChildBoundsProperty() const |
100 | 0 | { |
101 | 0 | return m_childBoundsProperty; |
102 | 0 | } |
103 | | |
104 | | AbcA::TimeSamplingPtr getTimeSampling() const; |
105 | | |
106 | | bool isConstant() const; |
107 | | |
108 | | size_t getNumSamples() const; |
109 | | |
110 | | // compound property to use as parent for any arbitrary GeomParams |
111 | | // underneath it |
112 | 0 | ICompoundProperty getArbGeomParams() const { return m_arbGeomParams; } |
113 | 0 | ICompoundProperty getUserProperties() const { return m_userProperties; } |
114 | | |
115 | | //! Reset returns this function set to an empty, default |
116 | | //! state. |
117 | | void reset() |
118 | 0 | { |
119 | 0 | m_childBoundsProperty.reset(); |
120 | 0 | m_arbGeomParams.reset(); |
121 | 0 | m_userProperties.reset(); |
122 | 0 | m_cameraSchema.reset(); |
123 | 0 | Abc::ISchema<LightSchemaInfo>::reset(); |
124 | 0 | } |
125 | | |
126 | | //! Returns whether this function set is valid. |
127 | | bool valid() const |
128 | 0 | { |
129 | 0 | return ( Abc::ISchema<LightSchemaInfo>::valid() ); |
130 | 0 | } |
131 | | |
132 | | //! unspecified-bool-type operator overload. |
133 | | //! ... |
134 | | ALEMBIC_OVERRIDE_OPERATOR_BOOL( ILightSchema::valid() ); |
135 | | |
136 | | protected: |
137 | | void init( const Abc::Argument& iArg0, |
138 | | const Abc::Argument& iArg1 ); |
139 | | |
140 | | Abc::IBox3dProperty m_childBoundsProperty; |
141 | | Abc::ICompoundProperty m_arbGeomParams; |
142 | | Abc::ICompoundProperty m_userProperties; |
143 | | |
144 | | Alembic::AbcGeom::ICameraSchema m_cameraSchema; |
145 | | }; |
146 | | |
147 | | //-***************************************************************************** |
148 | | // SCHEMA OBJECT |
149 | | //-***************************************************************************** |
150 | | typedef Abc::ISchemaObject< ILightSchema > ILight; |
151 | | |
152 | | typedef Util::shared_ptr< ILight > ILightPtr; |
153 | | |
154 | | } // End namespace ALEMBIC_VERSION_NS |
155 | | |
156 | | using namespace ALEMBIC_VERSION_NS; |
157 | | |
158 | | } // End namespace AbcGeom |
159 | | } // End namespace Alembic |
160 | | |
161 | | #endif |