Coverage Report

Created: 2025-07-23 06:21

/src/alembic/lib/Alembic/AbcGeom/OLight.h
Line
Count
Source (jump to first uncovered line)
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>
42
#include <Alembic/AbcGeom/OCamera.h>
43
#include <Alembic/AbcGeom/Foundation.h>
44
#include <Alembic/AbcGeom/SchemaInfoDeclarations.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
59
    typedef OLightSchema this_type;
60
61
    //-*************************************************************************
62
    // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
63
    //-*************************************************************************
64
65
    //! The default constructor creates an empty OLightMeshSchema
66
    //! ...
67
0
    OLightSchema() {}
68
69
    //! This constructor creates a new light writer.
70
    //! The first argument is an CompoundPropertyWriterPtr to use as a parent.
71
    //! The next is the name to give the schema which is usually the default
72
    //! name given by OLight (.geom)   The remaining optional arguments
73
    //! can be used to override the ErrorHandlerPolicy, to specify
74
    //! MetaData, specify sparse sampling and to set TimeSampling.
75
    OLightSchema( AbcA::CompoundPropertyWriterPtr iParent,
76
                  const std::string &iName,
77
                  const Abc::Argument &iArg0 = Abc::Argument(),
78
                  const Abc::Argument &iArg1 = Abc::Argument(),
79
                  const Abc::Argument &iArg2 = Abc::Argument(),
80
                  const Abc::Argument &iArg3 = Abc::Argument() );
81
82
    //! This constructor creates a new light writer.
83
    //! The first argument is an OCompundProperty to use as a parent, and from
84
    //! which the ErrorHandlerPolicy is derived.  The next is the name to give
85
    //! the schema which is usually the default name given by OLight (.geom)
86
    //! The remaining optional arguments can be used to specify MetaData,
87
    //! specify sparse sampling and to set TimeSampling.
88
    OLightSchema( Abc::OCompoundProperty iParent,
89
                     const std::string &iName,
90
                     const Abc::Argument &iArg0 = Abc::Argument(),
91
                     const Abc::Argument &iArg1 = Abc::Argument(),
92
                     const Abc::Argument &iArg2 = Abc::Argument() );
93
94
    //! Default assignment and copy operator used.
95
96
    //-*************************************************************************
97
    // SCHEMA STUFF
98
    //-*************************************************************************
99
100
    //! Return the time sampling.
101
0
    AbcA::TimeSamplingPtr getTimeSampling() const { return m_tsPtr; }
102
103
    //-*************************************************************************
104
    // SAMPLE STUFF
105
    //-*************************************************************************
106
107
    //! All of our properties are not mandatory so we'll just use the
108
    //! child bounds.
109
    size_t getNumSamples();
110
    //! Set a sample
111
    void setCameraSample( const CameraSample &iSamp );
112
113
    //! Set from previous sample.
114
    void setFromPrevious();
115
116
    void setTimeSampling( uint32_t iIndex );
117
    void setTimeSampling( AbcA::TimeSamplingPtr iTime );
118
119
    Abc::OCompoundProperty getUserProperties();
120
    Abc::OCompoundProperty getArbGeomParams();
121
    Abc::OBox3dProperty getChildBoundsProperty();
122
123
    //-*************************************************************************
124
    // ABC BASE MECHANISMS
125
    // These functions are used by Abc to deal with errors, validity,
126
    // and so on.
127
    //-*************************************************************************
128
129
    //! Reset returns this function set to an empty, default
130
    //! state.
131
    void reset()
132
0
    {
133
0
        m_userProperties.reset();
134
0
        m_arbGeomParams.reset();
135
0
        m_cameraSchema.reset();
136
0
        m_childBoundsProperty.reset();
137
0
        Abc::OSchema<LightSchemaInfo>::reset();
138
0
    }
139
140
    //! Returns whether this function set is valid.
141
    bool valid() const
142
0
    {
143
0
        return ( Abc::OSchema<LightSchemaInfo>::valid() );
144
0
    }
145
146
    //! unspecified-bool-type operator overload.
147
    //! ...
148
    ALEMBIC_OVERRIDE_OPERATOR_BOOL( OLightSchema::valid() );
149
150
protected:
151
152
    void init( AbcA::CompoundPropertyWriterPtr iParent,
153
               const Abc::Argument &iArg0,
154
               const Abc::Argument &iArg1,
155
               const Abc::Argument &iArg2,
156
               const Abc::Argument &iArg3 );
157
158
    AbcA::TimeSamplingPtr m_tsPtr;
159
160
    Abc::OBox3dProperty m_childBoundsProperty;
161
162
    Abc::OCompoundProperty m_userProperties;
163
    Abc::OCompoundProperty m_arbGeomParams;
164
165
    AbcGeom::OCameraSchema m_cameraSchema;
166
};
167
168
//-*****************************************************************************
169
// SCHEMA OBJECT
170
//-*****************************************************************************
171
typedef Abc::OSchemaObject<OLightSchema> OLight;
172
173
typedef Util::shared_ptr< OLight > OLightPtr;
174
175
} // End namespace ALEMBIC_VERSION_NS
176
177
using namespace ALEMBIC_VERSION_NS;
178
179
} // End namespace AbcGeom
180
} // End namespace Alembic
181
182
#endif