summaryrefslogtreecommitdiffstats
path: root/o3d/plugin/idl/param.idl
blob: e57f8fe2a6d9d2cd6ee8ad1adbe9d8abf16de1a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/*
 * Copyright 2009, Google Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

namespace o3d {

typedef Param[] ParamVector;

%[
  Params store data defined name/value pairs on ParamObjects.
  Each Param has a name, a type and a value that can be set and queried.
  One of their uses is to hold "uniform constants" used to parameterize shaders.
  Params can be connected in a source/destination fashion such that a target
  Param gets its value from the source param.
%]

[nocpp, include="core/cross/param.h"] class Param : NamedObjectBase {

  [verbatim=cpp_header] %{
  static int data_length_[NUM_PARAM_TYPES];  // Data size requirements per type

  void *data_;  // Storage for Param value
  const void *handle_;  // Handle to an implementation specific object holding
                        // corresponding to the Param
  %}

  %[
    If true, this param will make sure its input param is up to date when
    using it as a source. Default = true.

    This is for helping with Param cycles.

    If paramA gets its value from paramB and paramB gets its value from
    paramA:\n
    If you go paramA.value, paramB will evaluate then copy to paramA.\n
    If you go paramB.value, paramA will evaluate then copy to paramB.\n
    If you set paramB.updateInput = false, then:\n
    If you go paramA.value, paramB will evaluate then copy to paramA.\n
    If you go paramB.value, paramB just copy paramA. paramA will NOT evaluate
    when paramB asks for its value.
  %]
  [getter, setter, property=rw] bool update_input;

  %[
    Directly binds two Param elements such that this
    parameter gets its value from the source parameter.  The
    source must be compatible with this parameter.

    \param source_param The parameter that the value originates from. Passing in
         null will unbind any parameter currently bound.
    \return True if the bind succeeded.
  %]
  bool Bind(Param? source_param);

  %[
    Breaks any input connection coming into the Param.
  %]
  void UnbindInput();

  %[
    Breaks a specific param-bind output connection on this param.

    \param destination_param param to unbind.
  %]
  void UnbindOutput(Param destination_param);

  %[
    Breaks all param-bind output connections on this param.
  %]
  void UnbindOutputs();

  %[
    If true the param is read only. Its value can not be set nor can it be used
    as the destination in a ParamBind
  %]
  [getter, property=r] bool read_only_;

  %[
    The input connection for this param.
  %]
  [getter, property_r] Param? input_connection;

  %[
    The output connections for this param.
  %]
  [getter, property=r] ParamVector output_connections;
};

%[
  A Param class which stores a single float.
  Default Value = 0.
%]
[nocpp, include="core/cross/param.h"] class ParamFloat : Param {
  %[
    The float stored by the Param.
  %]
  [getter, setter, property=rw] float value_;
};

%[
  A Param class which stores a Float2.
  Default Value = [0, 0].
%]
[nocpp, include="core/cross/param.h"] class ParamFloat2 : Param {
  %[
    The Float2 stored by the Param as an array of 2 numbers.
  %]
  [setter, getter, property=rw, nocpp] Float2 value;

  %[
    Sets the value of ParamFloat2 by 2 numbers.
    \param v0 first value.
    \param v1 second value.
  %]
  [userglue] void set(float v0, float v1);

  [verbatim=cpp_glue] %{
    void userglue_method_set(o3d::ParamFloat2* self,
                             float v0,
                             float v1) {
      self->set_value(o3d::Float2(v0, v1));
    }
  %}
};

%[
  A Param class which stores a Float3.
  Default Value = [0, 0, 0].
%]
[nocpp, include="core/cross/param.h"] class ParamFloat3 : Param {
  %[
    The Float3 stored by the Param as an array of 3 numbers.
  %]
  [setter, getter, property=rw, nocpp] Float3 value;

  %[
    Sets the entries of the value of ParamFloat3 to the 3 given numbers.
    \param v0 first value.
    \param v1 second value.
    \param v2 third value.
  %]
  [userglue] void set(float v0, float v1, float v2);

  [verbatim=cpp_glue] %{
    void userglue_method_set(o3d::ParamFloat3* self,
                             float v0,
                             float v1,
                             float v2) {
      self->set_value(o3d::Float3(v0, v1, v2));
    }
  %}
};

%[
  A Param class which stores a Float4.
  Default Value = [0, 0, 0, 0].
%]
[nocpp, include="core/cross/param.h"] class ParamFloat4 : Param {
  %[
    The Float4 stored by the Param as an array of 4 numbers.
  %]
  [setter, getter, property=rw, nocpp] Float4 value;

  %[
    Sets the value of ParamFloat4 by 4 numbers.
    \param v0 first value.
    \param v1 second value.
    \param v2 third value.
    \param v3 fourth value.
  %]
  [userglue] void set(float v0, float v1, float v2, float v3);

  [verbatim=cpp_glue] %{
    void userglue_method_set(o3d::ParamFloat4* self,
                             float v0,
                             float v1,
                             float v2,
                             float v3) {
      self->set_value(o3d::Float4(v0, v1, v2, v3));
    }
  %}
};

%[
  A Param class which stores a 4-by-4 matrix.
  Default Value = Identity.
%]
[nocpp, include="core/cross/param.h"] class ParamMatrix4 : Param {
  %[
    Sets the 4-by-4 matrix stored by the Param by a length-4 array of arrays of
    4 numbers.
  %]
  [getter, setter, property=rw, nocpp] Vectormath::Aos::Matrix4 value;
};

%[
  A Param class which stores an integer.
  Default Value = 0.
%]
[nocpp, include="core/cross/param.h"] class ParamInteger : Param {
  %[
    The integer stored by the Param.
  %]
  [getter, setter, property=rw] int value_;
};

%[
  A Param class which stores a boolean.
  Default Value = false.
%]
[nocpp, include="core/cross/param.h"] class ParamBoolean : Param {
  %[
    The boolean stored by the Param.
  %]
  [getter, setter, property=rw] bool value_;
};

%[
  A Param which stores a string.
  Default Value = "".
%]
[nocpp, include="core/cross/param.h"] class ParamString : Param {
  %[
    The string stored by the Param.
  %]
  [getter, setter, property=rw] String value_;
};

%[
  A Param which stores a Sampler.
%]
[nocpp, include="core/cross/sampler.h"] class ParamSampler : Param {
  %[
    The Sampler stored by the Param.
  %]
  [getter, setter, property=rw] Sampler? value_;
};

%[
 A Param which stores a Texture.
%]
[nocpp, include="core/cross/param.h"] class ParamTexture : Param {
  %[
    The Texture stored by the Param.
  %]
  [getter, setter, property=rw] Texture? value_;
};

%[
  A Param which stores a Material.
%]
[nocpp, include="core/cross/param.h"] class ParamMaterial : Param {
  %[
    The Material stored by the Param.
  %]
  [getter, setter, property=rw] Material? value_;
};

%[
  A Param which stores a State.
%]
[nocpp, include="core/cross/param.h"] class ParamState : Param {
  %[
    The State stored by the Param.
  %]
  [getter, setter, property=rw] State? value_;
};

%[
  A Param which stores a Effect.
%]
[nocpp, include="core/cross/param.h"] class ParamEffect : Param {
  %[
    The Effect stored by the Param.
  %]
  [getter, setter, property=rw] Effect? value_;
};

%[
  A Param which stores a Transform.
%]
[nocpp, include="core/cross/param.h"] class ParamTransform : Param {
  %[
    The Transform stored by the Param.
  %]
  [getter, setter, property=rw] Transform? value_;
};

%[
  A Param which stores a DrawList.
%]
[nocpp, include="core/cross/param.h"] class ParamDrawList : Param {
  %[
    The DrawList stored by the Param.
  %]
  [getter, setter, property=rw] DrawList? value_;
};

%[
  A Param which stores a DrawContext.
%]
[nocpp, include="core/cross/param.h"] class ParamDrawContext : Param {
  %[
    The DrawContext stored by the Param.
  %]
  [getter, setter, property=rw] DrawContext? value_;
};

}  // namespace o3d