/
glkit.cs
701 lines (545 loc) · 23.3 KB
/
glkit.cs
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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
//
// GLKit.cs: bindings to the iOS5/Lion GLKit
//
// Authors:
// Miguel de Icaza
//
// Copyright 2011 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Foundation;
using ObjCRuntime;
using CoreGraphics;
using CoreFoundation;
using ModelIO;
#if NET
using Vector3 = global::System.Numerics.Vector3;
using Vector4 = global::System.Numerics.Vector4;
using Matrix3 = global::CoreGraphics.RMatrix3;
using Matrix4 = global::System.Numerics.Matrix4x4;
#else
using Vector3 = global::OpenTK.Vector3;
using Vector4 = global::OpenTK.Vector4;
using Matrix3 = global::OpenTK.Matrix3;
using Matrix4 = global::OpenTK.Matrix4;
#endif // NET
#if MONOMAC
#if NET
using pfloat = System.Runtime.InteropServices.NFloat;
#else
using pfloat = System.nfloat;
#endif
using AppKit;
using EAGLSharegroup = Foundation.NSObject;
using EAGLContext = Foundation.NSObject;
using UIView = AppKit.NSView;
using UIImage = AppKit.NSImage;
using UIViewController = AppKit.NSViewController;
#else
using OpenGLES;
using UIKit;
using pfloat = System.Single;
using NSOpenGLContext = Foundation.NSObject;
#endif
#if !NET
using NativeHandle = System.IntPtr;
#endif
namespace GLKit {
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[Static]
interface GLKModelError {
[Field ("kGLKModelErrorDomain")]
NSString Domain { get; }
[Field ("kGLKModelErrorKey")]
NSString Key { get; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
interface GLKBaseEffect : GLKNamedEffect {
[Export ("colorMaterialEnabled", ArgumentSemantic.Assign)]
bool ColorMaterialEnabled { get; set; }
[Export ("useConstantColor", ArgumentSemantic.Assign)]
bool UseConstantColor { get; set; }
[Export ("transform")]
GLKEffectPropertyTransform Transform { get; }
[Export ("light0")]
GLKEffectPropertyLight Light0 { get; }
[Export ("light1")]
GLKEffectPropertyLight Light1 { get; }
[Export ("light2")]
GLKEffectPropertyLight Light2 { get; }
[Export ("lightingType", ArgumentSemantic.Assign)]
GLKLightingType LightingType { get; set; }
[Export ("lightModelAmbientColor", ArgumentSemantic.Assign)]
Vector4 LightModelAmbientColor { [Align (16)] get; set; }
[Export ("material")]
GLKEffectPropertyMaterial Material { get; }
[Export ("texture2d0")]
GLKEffectPropertyTexture Texture2d0 { get; }
[Export ("texture2d1")]
GLKEffectPropertyTexture Texture2d1 { get; }
[NullAllowed] // by default this property is null
[Export ("textureOrder", ArgumentSemantic.Copy)]
GLKEffectPropertyTexture [] TextureOrder { get; set; }
[Export ("constantColor", ArgumentSemantic.Assign)]
Vector4 ConstantColor { [Align (16)] get; set; }
[Export ("fog")]
GLKEffectPropertyFog Fog { get; }
[Export ("label", ArgumentSemantic.Copy)]
[DisableZeroCopy]
[NullAllowed] // default is null on iOS 5.1.1
string Label { get; set; }
[Export ("lightModelTwoSided", ArgumentSemantic.Assign)]
bool LightModelTwoSided { get; set; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
interface GLKEffectProperty {
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (GLKEffectProperty))]
interface GLKEffectPropertyFog {
[Export ("mode", ArgumentSemantic.Assign)]
GLKFogMode Mode { get; set; }
[Export ("color", ArgumentSemantic.Assign)]
Vector4 Color { [Align (16)] get; set; }
[Export ("density", ArgumentSemantic.Assign)]
float Density { get; set; } /* GLfloat = float */
[Export ("start", ArgumentSemantic.Assign)]
float Start { get; set; } /* GLfloat = float */
[Export ("end", ArgumentSemantic.Assign)]
float End { get; set; } /* GLfloat = float */
[Export ("enabled", ArgumentSemantic.Assign)]
bool Enabled { get; set; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (GLKEffectProperty))]
interface GLKEffectPropertyLight {
[Export ("position", ArgumentSemantic.Assign)]
Vector4 Position { [Align (16)] get; set; }
[Export ("ambientColor", ArgumentSemantic.Assign)]
Vector4 AmbientColor { [Align (16)] get; set; }
[Export ("diffuseColor", ArgumentSemantic.Assign)]
Vector4 DiffuseColor { [Align (16)] get; set; }
[Export ("specularColor", ArgumentSemantic.Assign)]
Vector4 SpecularColor { [Align (16)] get; set; }
[Export ("spotDirection", ArgumentSemantic.Assign)]
Vector3 SpotDirection { get; set; }
[Export ("spotExponent", ArgumentSemantic.Assign)]
float SpotExponent { get; set; } /* GLfloat = float */
[Export ("spotCutoff", ArgumentSemantic.Assign)]
float SpotCutoff { get; set; } /* GLfloat = float */
[Export ("constantAttenuation", ArgumentSemantic.Assign)]
float ConstantAttenuation { get; set; } /* GLfloat = float */
[Export ("linearAttenuation", ArgumentSemantic.Assign)]
float LinearAttenuation { get; set; } /* GLfloat = float */
[Export ("quadraticAttenuation", ArgumentSemantic.Assign)]
float QuadraticAttenuation { get; set; } /* GLfloat = float */
[NullAllowed] // by default this property is null
[Export ("transform", ArgumentSemantic.Retain)]
GLKEffectPropertyTransform Transform { get; set; }
[Export ("enabled", ArgumentSemantic.Assign)]
bool Enabled { get; set; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (GLKEffectProperty))]
interface GLKEffectPropertyMaterial {
[Export ("diffuseColor", ArgumentSemantic.Assign)]
Vector4 DiffuseColor { [Align (16)] get; set; }
[Export ("specularColor", ArgumentSemantic.Assign)]
Vector4 SpecularColor { [Align (16)] get; set; }
[Export ("emissiveColor", ArgumentSemantic.Assign)]
Vector4 EmissiveColor { [Align (16)] get; set; }
[Export ("shininess", ArgumentSemantic.Assign)]
float Shininess { get; set; } /* GLfloat = float */
[Export ("ambientColor", ArgumentSemantic.Assign)]
Vector4 AmbientColor { [Align (16)] get; set; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (GLKEffectProperty))]
interface GLKEffectPropertyTexture {
[Export ("target", ArgumentSemantic.Assign)]
GLKTextureTarget Target { get; set; }
[Export ("envMode", ArgumentSemantic.Assign)]
GLKTextureEnvMode EnvMode { get; set; }
[Export ("enabled", ArgumentSemantic.Assign)]
bool Enabled { get; set; }
[Export ("name", ArgumentSemantic.Assign)]
uint GLName { get; set; } /* GLuint = uint32_t */
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (GLKEffectProperty))]
interface GLKEffectPropertyTransform {
[Export ("normalMatrix")]
Matrix3 NormalMatrix { get; }
[Export ("modelviewMatrix", ArgumentSemantic.Assign)]
Matrix4 ModelViewMatrix { [Align (16)] get; set; }
[Export ("projectionMatrix", ArgumentSemantic.Assign)]
Matrix4 ProjectionMatrix { [Align (16)] get; set; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor] // - (nullable instancetype)init NS_UNAVAILABLE;
interface GLKMesh {
[Export ("initWithMesh:error:")]
NativeHandle Constructor (MDLMesh mesh, out NSError error);
// generator does not like `out []` -> https://trello.com/c/sZYNalbB/524-generator-support-out
[Internal] // there's another, manual, public API exposed
[Static]
[Export ("newMeshesFromAsset:sourceMeshes:error:")]
[return: NullAllowed]
GLKMesh [] FromAsset (MDLAsset asset, out NSArray sourceMeshes, out NSError error);
[Export ("vertexCount")]
nuint VertexCount { get; }
[Export ("vertexBuffers")]
GLKMeshBuffer [] VertexBuffers { get; }
[Export ("vertexDescriptor")]
MDLVertexDescriptor VertexDescriptor { get; }
[Export ("submeshes")]
GLKSubmesh [] Submeshes { get; }
[Export ("name")]
string Name { get; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface GLKMeshBuffer : MDLMeshBuffer {
[Export ("glBufferName")]
uint GlBufferName { get; }
[Export ("offset")]
nuint Offset { get; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface GLKMeshBufferAllocator : MDLMeshBufferAllocator {
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
[Model]
[Protocol]
interface GLKNamedEffect {
[Abstract]
[Export ("prepareToDraw")]
void PrepareToDraw ();
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (GLKBaseEffect))]
interface GLKReflectionMapEffect : GLKNamedEffect {
[Export ("textureCubeMap")]
GLKEffectPropertyTexture TextureCubeMap { get; }
[Export ("matrix", ArgumentSemantic.Assign)]
Matrix3 Matrix { get; set; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
interface GLKSkyboxEffect : GLKNamedEffect {
[Export ("center", ArgumentSemantic.Assign)]
Vector3 Center { get; set; }
[Export ("xSize", ArgumentSemantic.Assign)]
float XSize { get; set; } /* GLfloat = float */
[Export ("ySize", ArgumentSemantic.Assign)]
float YSize { get; set; } /* GLfloat = float */
[Export ("zSize", ArgumentSemantic.Assign)]
float ZSize { get; set; } /* GLfloat = float */
[Export ("textureCubeMap")]
GLKEffectPropertyTexture TextureCubeMap { get; }
[Export ("transform")]
GLKEffectPropertyTransform Transform { get; }
[NullAllowed] // by default this property is null
[Export ("label", ArgumentSemantic.Copy)]
[DisableZeroCopy]
string Label { get; set; }
[Export ("draw")]
void Draw ();
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor] // (nullable instancetype)init NS_UNAVAILABLE;
interface GLKSubmesh {
// Problematic, OpenTK has this define in 3 namespaces in:
// OpenTK.Graphics.ES11.DataType
// OpenTK.Graphics.ES20.DataType
// OpenTK.Graphics.ES30.DataType
[Export ("type")]
uint Type { get; }
// Problematic, OpenTK has this define in 3 namespaces in:
// OpenTK.Graphics.ES11.BeginMode
// OpenTK.Graphics.ES20.BeginMode
// OpenTK.Graphics.ES30.BeginMode
[Export ("mode")]
uint Mode { get; }
[Export ("elementCount")]
int ElementCount { get; }
[Export ("elementBuffer")]
GLKMeshBuffer ElementBuffer { get; }
[NullAllowed, Export ("mesh", ArgumentSemantic.Weak)]
GLKMesh Mesh { get; }
[Export ("name")]
string Name { get; }
}
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
interface GLKTextureInfo : NSCopying {
[Export ("width")]
int Width { get; } /* GLuint = uint32_t */
[Export ("height")]
int Height { get; } /* GLuint = uint32_t */
[Export ("alphaState")]
GLKTextureInfoAlphaState AlphaState { get; }
[Export ("textureOrigin")]
GLKTextureInfoOrigin TextureOrigin { get; }
[Export ("containsMipmaps")]
bool ContainsMipmaps { get; }
[Export ("name")]
uint Name { get; } /* GLuint = uint32_t */
[Export ("target")]
GLKTextureTarget Target { get; }
[Export ("mimapLevelCount")]
uint MimapLevelCount { get; }
[Export ("arrayLength")]
uint ArrayLength { get; }
[Export ("depth")]
uint Depth { get; }
}
delegate void GLKTextureLoaderCallback (GLKTextureInfo textureInfo, NSError error);
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
interface GLKTextureLoader {
[Static]
[Export ("textureWithContentsOfFile:options:error:")]
[return: NullAllowed]
GLKTextureInfo FromFile (string path, [NullAllowed] NSDictionary textureOperations, out NSError error);
[Static]
[Export ("textureWithContentsOfURL:options:error:")]
[return: NullAllowed]
GLKTextureInfo FromUrl (NSUrl url, [NullAllowed] NSDictionary textureOperations, out NSError error);
[Static]
[Export ("textureWithContentsOfData:options:error:")]
[return: NullAllowed]
GLKTextureInfo FromData (NSData data, [NullAllowed] NSDictionary textureOperations, out NSError error);
[Static]
[Export ("textureWithCGImage:options:error:")]
[return: NullAllowed]
GLKTextureInfo FromImage (CGImage cgImage, [NullAllowed] NSDictionary textureOperations, out NSError error);
[Static]
[Export ("cubeMapWithContentsOfFiles:options:error:"), Internal]
[return: NullAllowed]
GLKTextureInfo CubeMapFromFiles (NSArray paths, [NullAllowed] NSDictionary textureOperations, out NSError error);
[Static]
[Export ("cubeMapWithContentsOfFile:options:error:")]
[return: NullAllowed]
GLKTextureInfo CubeMapFromFile (string path, [NullAllowed] NSDictionary textureOperations, out NSError error);
[Static]
[Export ("cubeMapWithContentsOfURL:options:error:")]
[return: NullAllowed]
GLKTextureInfo CubeMapFromUrl (NSUrl url, [NullAllowed] NSDictionary textureOperations, out NSError error);
[Static]
[Export ("textureWithName:scaleFactor:bundle:options:error:")]
[return: NullAllowed]
GLKTextureInfo FromName (string name, nfloat scaleFactor, [NullAllowed] NSBundle bundle, [NullAllowed] NSDictionary<NSString, NSNumber> options, out NSError outError);
[NoiOS]
[NoMacCatalyst]
[NoWatch]
[NoTV]
[Export ("initWithShareContext:")]
NativeHandle Constructor (NSOpenGLContext context);
[NoMac]
[Export ("initWithSharegroup:")]
NativeHandle Constructor (EAGLSharegroup sharegroup);
[Export ("textureWithContentsOfFile:options:queue:completionHandler:")]
[Async]
void BeginTextureLoad (string file, [NullAllowed] NSDictionary textureOperations, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback onComplete);
[Export ("textureWithContentsOfURL:options:queue:completionHandler:")]
[Async]
void BeginTextureLoad (NSUrl filePath, [NullAllowed] NSDictionary textureOperations, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback onComplete);
[Export ("textureWithContentsOfData:options:queue:completionHandler:")]
[Async]
void BeginTextureLoad (NSData data, [NullAllowed] NSDictionary textureOperations, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback onComplete);
[Export ("textureWithCGImage:options:queue:completionHandler:")]
[Async]
void BeginTextureLoad (CGImage image, [NullAllowed] NSDictionary textureOperations, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback onComplete);
[Export ("cubeMapWithContentsOfFiles:options:queue:completionHandler:"), Internal]
[Async]
void BeginLoadCubeMap (NSArray filePaths, [NullAllowed] NSDictionary textureOperations, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback onComplete);
[Export ("cubeMapWithContentsOfFile:options:queue:completionHandler:")]
[Async]
void BeginLoadCubeMap (string fileName, [NullAllowed] NSDictionary textureOperations, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback onComplete);
[Export ("cubeMapWithContentsOfURL:options:queue:completionHandler:")]
[Async]
void BeginLoadCubeMap (NSUrl filePath, [NullAllowed] NSDictionary textureOperations, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback onComplete);
[Export ("textureWithName:scaleFactor:bundle:options:queue:completionHandler:")]
[Async]
void BeginTextureLoad (string name, nfloat scaleFactor, [NullAllowed] NSBundle bundle, [NullAllowed] NSDictionary<NSString, NSNumber> options, [NullAllowed] DispatchQueue queue, GLKTextureLoaderCallback block);
[Field ("GLKTextureLoaderApplyPremultiplication")]
NSString ApplyPremultiplication { get; }
[Field ("GLKTextureLoaderGenerateMipmaps")]
NSString GenerateMipmaps { get; }
[Field ("GLKTextureLoaderOriginBottomLeft")]
NSString OriginBottomLeft { get; }
[Field ("GLKTextureLoaderGrayscaleAsAlpha")]
NSString GrayscaleAsAlpha { get; }
[Field ("GLKTextureLoaderSRGB")]
NSString SRGB { get; }
[Field ("GLKTextureLoaderErrorDomain")]
NSString ErrorDomain { get; }
[Field ("GLKTextureLoaderErrorKey")]
NSString ErrorKey { get; }
[Field ("GLKTextureLoaderGLErrorKey")]
NSString GLErrorKey { get; }
}
[NoMac]
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[BaseType (typeof (UIView), Delegates = new string [] { "WeakDelegate" }, Events = new Type [] { typeof (GLKViewDelegate) })]
interface GLKView {
[Export ("initWithFrame:")]
NativeHandle Constructor (CGRect frame);
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
NSObject WeakDelegate { get; set; }
[Wrap ("WeakDelegate")]
IGLKViewDelegate Delegate { get; set; }
[NullAllowed] // by default this property is null
[Export ("context", ArgumentSemantic.Retain)]
EAGLContext Context { get; set; }
[Export ("drawableWidth")]
nint DrawableWidth { get; }
[Export ("drawableHeight")]
nint DrawableHeight { get; }
[Export ("drawableColorFormat")]
GLKViewDrawableColorFormat DrawableColorFormat { get; set; }
[Export ("drawableDepthFormat")]
GLKViewDrawableDepthFormat DrawableDepthFormat { get; set; }
[Export ("drawableStencilFormat")]
GLKViewDrawableStencilFormat DrawableStencilFormat { get; set; }
[Export ("drawableMultisample")]
GLKViewDrawableMultisample DrawableMultisample { get; set; }
[Export ("enableSetNeedsDisplay")]
bool EnableSetNeedsDisplay { get; set; }
[Export ("initWithFrame:context:")]
NativeHandle Constructor (CGRect frame, EAGLContext context);
[Export ("bindDrawable")]
void BindDrawable ();
[Export ("snapshot")]
UIImage Snapshot ();
[Export ("display")]
void Display ();
[Export ("deleteDrawable")]
void DeleteDrawable ();
}
interface IGLKViewDelegate { }
[NoMac]
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
[Model]
[Protocol]
interface GLKViewDelegate {
[Abstract]
[Export ("glkView:drawInRect:"), EventArgs ("GLKViewDraw")]
void DrawInRect (GLKView view, CGRect rect);
}
[NoMac]
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[BaseType (typeof (UIViewController))]
interface GLKViewController : GLKViewDelegate {
[Export ("initWithNibName:bundle:")]
[PostGet ("NibBundle")]
NativeHandle Constructor ([NullAllowed] string nibName, [NullAllowed] NSBundle bundle);
[Export ("preferredFramesPerSecond")]
nint PreferredFramesPerSecond { get; set; }
[Export ("framesPerSecond")]
nint FramesPerSecond { get; }
[Export ("paused")]
bool Paused { [Bind ("isPaused")] get; set; }
[Export ("framesDisplayed")]
nint FramesDisplayed { get; }
[Export ("timeSinceFirstResume")]
double TimeSinceFirstResume { get; }
[Export ("timeSinceLastResume")]
double TimeSinceLastResume { get; }
[Export ("timeSinceLastUpdate")]
double TimeSinceLastUpdate { get; }
[Export ("timeSinceLastDraw")]
double TimeSinceLastDraw { get; }
[Export ("pauseOnWillResignActive")]
bool PauseOnWillResignActive { get; set; }
[Export ("resumeOnDidBecomeActive")]
bool ResumeOnDidBecomeActive { get; set; }
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
NSObject WeakDelegate { get; set; }
[Wrap ("WeakDelegate")]
IGLKViewControllerDelegate Delegate { get; set; }
// Pseudo-documented, if the user overrides it, call this instead of the delegate method
[Export ("update")]
void Update ();
}
interface IGLKViewControllerDelegate { }
[NoMac]
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'Metal' instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'Metal' instead.")]
[BaseType (typeof (NSObject))]
[Model]
[Protocol]
interface GLKViewControllerDelegate {
[Abstract]
[Export ("glkViewControllerUpdate:")]
void Update (GLKViewController controller);
[Export ("glkViewController:willPause:")]
void WillPause (GLKViewController controller, bool pause);
}
}