HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OMaterial.h
Go to the documentation of this file.
1 //-*****************************************************************************
2 //
3 // Copyright (c) 2009-2015,
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_AbcMaterial_OMaterial_h_
38 #define _Alembic_AbcMaterial_OMaterial_h_
39 
40 #include <Alembic/Abc/All.h>
41 
42 #include <Alembic/Util/Export.h>
44 
45 namespace Alembic {
46 namespace AbcMaterial {
47 namespace ALEMBIC_VERSION_NS {
48 
49 //! Schema for writing shader definitions as either an object or
50 //! a compound property.
51 //! Only "monolithic" shader definitions (i.e. non network) are presently
52 //! supported in this implementation.
54  : public Abc::OSchema<MaterialSchemaInfo>
55 {
56 public:
57 
58  //-------------------------------------------------------------------------
59  //BOILERPLATE
60 
62 
64 
65  template <class CPROP_PTR>
66  OMaterialSchema( CPROP_PTR iParent,
67  const std::string &iName,
68  const Abc::Argument &iArg0 = Abc::Argument(),
69  const Abc::Argument &iArg1 = Abc::Argument(),
70  const Abc::Argument &iArg2 = Abc::Argument() )
71  : Abc::OSchema<MaterialSchemaInfo>( iParent, iName, iArg0, iArg1, iArg2 )
72  {
73  init();
74  }
75 
76  template <class CPROP_PTR>
77  explicit OMaterialSchema( CPROP_PTR iParent,
78  const Abc::Argument &iArg0 = Abc::Argument(),
79  const Abc::Argument &iArg1 = Abc::Argument(),
80  const Abc::Argument &iArg2 = Abc::Argument() )
81  : Abc::OSchema<MaterialSchemaInfo>( iParent, iArg0, iArg1, iArg2 )
82  {
83  init();
84  }
85 
86  //! Copy constructor.
88  : Abc::OSchema<MaterialSchemaInfo>()
89  {
90  *this = iCopy;
91  }
92 
93  //-------------------------------------------------------------------------
94  //ACTUAL STUFF
95 
96  //! Declare shader for a given target and shaderType.
97  //! "Target's" value is an agreed upon convention for a renderer
98  //! or application (i.e. "prman")
99  //! "ShaderType's" value is an agreed upon convention for shader terminals
100  //! such as "surface," "displacement," "light", "coshader_somename."
101  //! "ShaderName's" value is an identifier meaningful to the target
102  //! application (i.e. "paintedplastic," "fancy_spot_light").
103  //! It's only valid to call this once per target/shaderType combo.
104  void setShader( const std::string & iTarget,
105  const std::string & iShaderType,
106  const std::string & iShaderName );
107 
108  //! Declare and retrieve a container for storing properties representing
109  //! parameters for the target and shaderType. You put them in there
110  //! yourself since there are no restrictions on type or sampling other
111  //! than what's appropriate and meaningful for the target application.
112  //! Repeated calls will return the same object.
113  Abc::OCompoundProperty getShaderParameters(
114  const std::string & iTarget, const std::string & iShaderType );
115 
116  //add node by name, target, type, set node connection?, set node
117  //terminals?
118 
119  void addNetworkNode( const std::string & iNodeName,
120  const std::string & iTarget,
121  const std::string & iNodeType );
122 
123  void setNetworkNodeConnection( const std::string & iNodeName,
124  const std::string & iInputName,
125  const std::string & iConnectedNodeName,
126  const std::string & iConnectedOutputName );
127 
129  getNetworkNodeParameters( const std::string & iNodeName );
130 
131  void setNetworkTerminal( const std::string & iTarget,
132  const std::string & iShaderType,
133  const std::string & iNodeName,
134  const std::string & iOutputName = "" );
135 
136  void
137  setNetworkInterfaceParameterMapping(
138  const std::string & iInterfaceParamName,
139  const std::string & iMapToNodeName,
140  const std::string & iMapToParamName );
141 
142  Abc::OCompoundProperty getNetworkInterfaceParameters();
143 
144 protected:
145 
146  void init();
147 
148  // all the network nodes will be placed under this property
150  void createNodeCompound();
151 
152  class Data;
153 
154  // shared and not scoped because we want this to survive a copy
155  Util::shared_ptr< Data > m_data;
156 };
157 
158 //! Object declaration
160 
161 typedef Util::shared_ptr< OMaterial > OMaterialPtr;
162 
163 } // End namespace ALEMBIC_VERSION_NS
164 
165 using namespace ALEMBIC_VERSION_NS;
166 
167 } // End namespace AbcMaterial
168 } // End namespace Alembic
169 
170 
171 #endif
172 
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
OMaterialSchema(CPROP_PTR iParent, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument(), const Abc::Argument &iArg2=Abc::Argument())
Definition: OMaterial.h:77
Util::shared_ptr< OMaterial > OMaterialPtr
Definition: OMaterial.h:161
Abc::OSchemaObject< OMaterialSchema > OMaterial
Object declaration.
Definition: OMaterial.h:159
OMaterialSchema(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: OMaterial.h:66
OMaterialSchema(const OMaterialSchema &iCopy)
Copy constructor.
Definition: OMaterial.h:87
#define ALEMBIC_EXPORT
Definition: Export.h:51
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:104