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
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;
use crate::*;
/// The enoding of texel channel elements
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdltexturechannelencoding?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MDLTextureChannelEncoding(pub NSInteger);
impl MDLTextureChannelEncoding {
#[doc(alias = "MDLTextureChannelEncodingUInt8")]
pub const UInt8: Self = Self(1);
#[doc(alias = "MDLTextureChannelEncodingUint8")]
pub const Uint8: Self = Self(1);
#[doc(alias = "MDLTextureChannelEncodingUInt16")]
pub const UInt16: Self = Self(2);
#[doc(alias = "MDLTextureChannelEncodingUint16")]
pub const Uint16: Self = Self(2);
#[doc(alias = "MDLTextureChannelEncodingUInt24")]
pub const UInt24: Self = Self(3);
#[doc(alias = "MDLTextureChannelEncodingUint24")]
pub const Uint24: Self = Self(3);
#[doc(alias = "MDLTextureChannelEncodingUInt32")]
pub const UInt32: Self = Self(4);
#[doc(alias = "MDLTextureChannelEncodingUint32")]
pub const Uint32: Self = Self(4);
#[doc(alias = "MDLTextureChannelEncodingFloat16")]
pub const Float16: Self = Self(0x102);
#[doc(alias = "MDLTextureChannelEncodingFloat16SR")]
pub const Float16SR: Self = Self(0x302);
#[doc(alias = "MDLTextureChannelEncodingFloat32")]
pub const Float32: Self = Self(0x104);
}
unsafe impl Encode for MDLTextureChannelEncoding {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MDLTextureChannelEncoding {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// MDLTexture
/// a description of texels provided by a texture object.
///
///
/// A texture optionally generates or loads texels
/// through an access to the data property, or one of the other
/// properties, otherwise the texture object is a lightweight descriptor
/// only.
///
///
/// Texel data that will exist when referenced; it may or may not exist
/// before
///
/// texel width and height of the texture
///
/// The number of bytes from the first texel in a row to the first texel
/// in the next row. A rowStride of zero indicates that interleaved x,y
/// addressing of texels is not possible. This might be the case if the
/// texture was compressed in some manner, for example.
///
/// The number of channels incoded in a single texel. For example, an RGB
/// texture has 3 channels. All channels must have the same encoding.
///
/// The encoding of a channel in a single texel.
///
/// The texture encodes a cube map. If YES, then the layout of the cube
/// map is deduced as a vertical strip if dimension.y is six times
/// dimension.x. Other layouts are possible in the future.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdltexture?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLTexture;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLTexture {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLTexture {}
);
impl MDLTexture {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a texture from a source in the main bundle named in a manner matching
/// name.
#[unsafe(method(textureNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed(name: &NSString) -> Option<Retained<Self>>;
#[unsafe(method(textureNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_bundle(
name: &NSString,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLAssetResolver")]
#[unsafe(method(textureNamed:assetResolver:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_assetResolver(
name: &NSString,
resolver: &ProtocolObject<dyn MDLAssetResolver>,
) -> Option<Retained<Self>>;
/// Creates a cube texture map image using 6 faces of the same dimensions,
/// ordered +X,-X,+Y,-Y,+Z,-Z If the data is read back the image will be compacted
/// into a single vertical stack where dimensions.y = 6 * dimensions.x
/// isCube will return YES
///
///
/// Parameter `names`: a collection of mosaiced images in a cross formation or column or row.
/// - If 6 individual images are given they are assumed to be in order and will be
/// loaded as is.
/// - if 3 images of double height or width are given they will be treated as
/// pairs of + and - in each axis, the order is must be x, then y, then z.
/// - if 2 images of triple height or width are given they will be treates as a
/// positive set and a negative set in the order +x, +y, +z, then -x, -y, -z.
/// - if a single image is given it will be used without conversion if in column
/// orientation and demosaiced in all other instances.
#[unsafe(method(textureCubeWithImagesNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed(
names: &NSArray<NSString>,
) -> Option<Retained<Self>>;
#[unsafe(method(textureCubeWithImagesNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed_bundle(
names: &NSArray<NSString>,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
/// write a texture to URL, deducing type from path extension
#[unsafe(method(writeToURL:))]
#[unsafe(method_family = none)]
pub unsafe fn writeToURL(&self, url: &NSURL) -> bool;
/// write a particular level of a mipped texture to URL, deducing type from path extension
#[unsafe(method(writeToURL:level:))]
#[unsafe(method_family = none)]
pub unsafe fn writeToURL_level(&self, url: &NSURL, level: NSUInteger) -> bool;
#[cfg(feature = "objc2-core-foundation")]
/// write a texture to URL, using a specific UT type
#[unsafe(method(writeToURL:type:))]
#[unsafe(method_family = none)]
pub unsafe fn writeToURL_type(&self, nsurl: &NSURL, r#type: &CFString) -> bool;
#[cfg(feature = "objc2-core-foundation")]
/// write a particular level of a mipped texture to URL, using a specific UT type
#[unsafe(method(writeToURL:type:level:))]
#[unsafe(method_family = none)]
pub unsafe fn writeToURL_type_level(
&self,
nsurl: &NSURL,
r#type: &CFString,
level: NSUInteger,
) -> bool;
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(imageFromTexture))]
#[unsafe(method_family = none)]
pub unsafe fn imageFromTexture(&self) -> Option<Retained<CGImage>>;
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(imageFromTextureAtLevel:))]
#[unsafe(method_family = none)]
pub unsafe fn imageFromTextureAtLevel(
&self,
level: NSUInteger,
) -> Option<Retained<CGImage>>;
#[unsafe(method(texelDataWithTopLeftOrigin))]
#[unsafe(method_family = none)]
pub unsafe fn texelDataWithTopLeftOrigin(&self) -> Option<Retained<NSData>>;
#[unsafe(method(texelDataWithBottomLeftOrigin))]
#[unsafe(method_family = none)]
pub unsafe fn texelDataWithBottomLeftOrigin(&self) -> Option<Retained<NSData>>;
#[unsafe(method(texelDataWithTopLeftOriginAtMipLevel:create:))]
#[unsafe(method_family = none)]
pub unsafe fn texelDataWithTopLeftOriginAtMipLevel_create(
&self,
level: NSInteger,
create: bool,
) -> Option<Retained<NSData>>;
#[unsafe(method(texelDataWithBottomLeftOriginAtMipLevel:create:))]
#[unsafe(method_family = none)]
pub unsafe fn texelDataWithBottomLeftOriginAtMipLevel_create(
&self,
level: NSInteger,
create: bool,
) -> Option<Retained<NSData>>;
#[unsafe(method(rowStride))]
#[unsafe(method_family = none)]
pub unsafe fn rowStride(&self) -> NSInteger;
#[unsafe(method(channelCount))]
#[unsafe(method_family = none)]
pub unsafe fn channelCount(&self) -> NSUInteger;
#[unsafe(method(mipLevelCount))]
#[unsafe(method_family = none)]
pub unsafe fn mipLevelCount(&self) -> NSUInteger;
#[unsafe(method(channelEncoding))]
#[unsafe(method_family = none)]
pub unsafe fn channelEncoding(&self) -> MDLTextureChannelEncoding;
#[unsafe(method(isCube))]
#[unsafe(method_family = none)]
pub unsafe fn isCube(&self) -> bool;
/// Setter for [`isCube`][Self::isCube].
#[unsafe(method(setIsCube:))]
#[unsafe(method_family = none)]
pub unsafe fn setIsCube(&self, is_cube: bool);
/// hasAlphaValues
/// Can be overridden. If not overridden, hasAlpha will be NO if the texture does not
/// have an alpha channel. It wil be YES if the texture has an alpha channel and
/// there is at least one non-opaque texel in it.
#[unsafe(method(hasAlphaValues))]
#[unsafe(method_family = none)]
pub unsafe fn hasAlphaValues(&self) -> bool;
/// Setter for [`hasAlphaValues`][Self::hasAlphaValues].
#[unsafe(method(setHasAlphaValues:))]
#[unsafe(method_family = none)]
pub unsafe fn setHasAlphaValues(&self, has_alpha_values: bool);
);
}
/// Methods declared on superclass `NSObject`.
impl MDLTexture {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// MDLURLTexture
/// a texture provider initialized with a URL or file path.
///
/// if any of the properties of the texture, such as data, are referenced,
/// then the texture may be loaded, otherwise, the MDLURLTexture is merely
/// a lightweight reference to something that could be loaded
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlurltexture?language=objc)
#[unsafe(super(MDLTexture, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLURLTexture;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLURLTexture {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLURLTexture {}
);
impl MDLURLTexture {
extern_methods!(
#[unsafe(method(initWithURL:name:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithURL_name(
this: Allocated<Self>,
url: &NSURL,
name: Option<&NSString>,
) -> Retained<Self>;
#[unsafe(method(URL))]
#[unsafe(method_family = none)]
pub unsafe fn URL(&self) -> Retained<NSURL>;
/// Setter for [`URL`][Self::URL].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setURL:))]
#[unsafe(method_family = none)]
pub unsafe fn setURL(&self, url: &NSURL);
);
}
/// Methods declared on superclass `MDLTexture`.
impl MDLURLTexture {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a texture from a source in the main bundle named in a manner matching
/// name.
#[unsafe(method(textureNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed(name: &NSString) -> Option<Retained<Self>>;
#[unsafe(method(textureNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_bundle(
name: &NSString,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLAssetResolver")]
#[unsafe(method(textureNamed:assetResolver:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_assetResolver(
name: &NSString,
resolver: &ProtocolObject<dyn MDLAssetResolver>,
) -> Option<Retained<Self>>;
/// Creates a cube texture map image using 6 faces of the same dimensions,
/// ordered +X,-X,+Y,-Y,+Z,-Z If the data is read back the image will be compacted
/// into a single vertical stack where dimensions.y = 6 * dimensions.x
/// isCube will return YES
///
///
/// Parameter `names`: a collection of mosaiced images in a cross formation or column or row.
/// - If 6 individual images are given they are assumed to be in order and will be
/// loaded as is.
/// - if 3 images of double height or width are given they will be treated as
/// pairs of + and - in each axis, the order is must be x, then y, then z.
/// - if 2 images of triple height or width are given they will be treates as a
/// positive set and a negative set in the order +x, +y, +z, then -x, -y, -z.
/// - if a single image is given it will be used without conversion if in column
/// orientation and demosaiced in all other instances.
#[unsafe(method(textureCubeWithImagesNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed(
names: &NSArray<NSString>,
) -> Option<Retained<Self>>;
#[unsafe(method(textureCubeWithImagesNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed_bundle(
names: &NSArray<NSString>,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `NSObject`.
impl MDLURLTexture {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// MDLCheckerboardTexture
/// A two color checkboard with a certain number of divisions
///
///
/// the texture will be created if data is referenced, otherwise, this
/// object is merely a description
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlcheckerboardtexture?language=objc)
#[unsafe(super(MDLTexture, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLCheckerboardTexture;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLCheckerboardTexture {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLCheckerboardTexture {}
);
impl MDLCheckerboardTexture {
extern_methods!(
#[unsafe(method(divisions))]
#[unsafe(method_family = none)]
pub unsafe fn divisions(&self) -> c_float;
/// Setter for [`divisions`][Self::divisions].
#[unsafe(method(setDivisions:))]
#[unsafe(method_family = none)]
pub unsafe fn setDivisions(&self, divisions: c_float);
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(color1))]
#[unsafe(method_family = none)]
pub unsafe fn color1(&self) -> Option<Retained<CGColor>>;
#[cfg(feature = "objc2-core-graphics")]
/// Setter for [`color1`][Self::color1].
#[unsafe(method(setColor1:))]
#[unsafe(method_family = none)]
pub unsafe fn setColor1(&self, color1: Option<&CGColor>);
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(color2))]
#[unsafe(method_family = none)]
pub unsafe fn color2(&self) -> Option<Retained<CGColor>>;
#[cfg(feature = "objc2-core-graphics")]
/// Setter for [`color2`][Self::color2].
#[unsafe(method(setColor2:))]
#[unsafe(method_family = none)]
pub unsafe fn setColor2(&self, color2: Option<&CGColor>);
);
}
/// Methods declared on superclass `MDLTexture`.
impl MDLCheckerboardTexture {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a texture from a source in the main bundle named in a manner matching
/// name.
#[unsafe(method(textureNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed(name: &NSString) -> Option<Retained<Self>>;
#[unsafe(method(textureNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_bundle(
name: &NSString,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLAssetResolver")]
#[unsafe(method(textureNamed:assetResolver:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_assetResolver(
name: &NSString,
resolver: &ProtocolObject<dyn MDLAssetResolver>,
) -> Option<Retained<Self>>;
/// Creates a cube texture map image using 6 faces of the same dimensions,
/// ordered +X,-X,+Y,-Y,+Z,-Z If the data is read back the image will be compacted
/// into a single vertical stack where dimensions.y = 6 * dimensions.x
/// isCube will return YES
///
///
/// Parameter `names`: a collection of mosaiced images in a cross formation or column or row.
/// - If 6 individual images are given they are assumed to be in order and will be
/// loaded as is.
/// - if 3 images of double height or width are given they will be treated as
/// pairs of + and - in each axis, the order is must be x, then y, then z.
/// - if 2 images of triple height or width are given they will be treates as a
/// positive set and a negative set in the order +x, +y, +z, then -x, -y, -z.
/// - if a single image is given it will be used without conversion if in column
/// orientation and demosaiced in all other instances.
#[unsafe(method(textureCubeWithImagesNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed(
names: &NSArray<NSString>,
) -> Option<Retained<Self>>;
#[unsafe(method(textureCubeWithImagesNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed_bundle(
names: &NSArray<NSString>,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `NSObject`.
impl MDLCheckerboardTexture {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// MDLSkyCubeTexture
/// A physically realistic sky as a cube texture
///
///
/// 1.0 is at the nadir. Use in conjunction with turbidity to give a dawn,
/// dusk, or noon look.
///
/// will impart very little color to the sky. A value of one simulates a
/// great deal of dust and moisture in the sky, and will cause the sun's
/// color to spread across the atmosphere.
///
/// a value of one will give noon-ish saturated colors.
///
/// the sky from the ground. A value of zero will yield a clear sky, a
/// value of one will reduce the contrast of the sky, making it a bit foggy.
///
///
/// by a color, horizonElevation is angle, in radians, below which the
/// replacement should occur. Negative values are below the horizon.
///
///
/// the color below the horizonElevation value blended with the w factor up to
/// Pi/2.0 past the horizon.
/// (e.g. w = 0.0 groundColor is applied immediatly on the horizon with no blend
/// w = Pi/2 groundColor is linearly applied all the way to the south pole)
/// NOTE: To maintain default behavior a simple length(groundColor) != 0 is used to determine
/// if we want to set the ground color (e.g. black and blended immediatly
/// on the horizon use (0.0, 0.0, 0.0, 0.0000001))
/// 4 component treats the first 3 components as color and w as blend factor
/// 3 component treats the first 3 components as color and 0 as blend factor
/// 2 component treats the first component as greyscale color and y as blend factor
/// 1 component treats the scalar component as greyscale color and 0 as blend factor
///
///
/// tone mapping.
///
///
///
///
///
/// are not compressed during tone mapping. Values between the x component
/// and y component are compressed to the maximum brightness value during
/// tone mapping. Values above the limit are clamped.
///
///
/// the texture will be created if data is referenced, otherwise, this
/// object is merely a description. All parameters have legal values between zero and one.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlskycubetexture?language=objc)
#[unsafe(super(MDLTexture, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLSkyCubeTexture;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLSkyCubeTexture {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLSkyCubeTexture {}
);
impl MDLSkyCubeTexture {
extern_methods!(
/// Call updateTexture if parameters have been changed and a new sky is required.
#[unsafe(method(updateTexture))]
#[unsafe(method_family = none)]
pub unsafe fn updateTexture(&self);
#[unsafe(method(turbidity))]
#[unsafe(method_family = none)]
pub unsafe fn turbidity(&self) -> c_float;
/// Setter for [`turbidity`][Self::turbidity].
#[unsafe(method(setTurbidity:))]
#[unsafe(method_family = none)]
pub unsafe fn setTurbidity(&self, turbidity: c_float);
#[unsafe(method(sunElevation))]
#[unsafe(method_family = none)]
pub unsafe fn sunElevation(&self) -> c_float;
/// Setter for [`sunElevation`][Self::sunElevation].
#[unsafe(method(setSunElevation:))]
#[unsafe(method_family = none)]
pub unsafe fn setSunElevation(&self, sun_elevation: c_float);
#[unsafe(method(sunAzimuth))]
#[unsafe(method_family = none)]
pub unsafe fn sunAzimuth(&self) -> c_float;
/// Setter for [`sunAzimuth`][Self::sunAzimuth].
#[unsafe(method(setSunAzimuth:))]
#[unsafe(method_family = none)]
pub unsafe fn setSunAzimuth(&self, sun_azimuth: c_float);
#[unsafe(method(upperAtmosphereScattering))]
#[unsafe(method_family = none)]
pub unsafe fn upperAtmosphereScattering(&self) -> c_float;
/// Setter for [`upperAtmosphereScattering`][Self::upperAtmosphereScattering].
#[unsafe(method(setUpperAtmosphereScattering:))]
#[unsafe(method_family = none)]
pub unsafe fn setUpperAtmosphereScattering(&self, upper_atmosphere_scattering: c_float);
#[unsafe(method(groundAlbedo))]
#[unsafe(method_family = none)]
pub unsafe fn groundAlbedo(&self) -> c_float;
/// Setter for [`groundAlbedo`][Self::groundAlbedo].
#[unsafe(method(setGroundAlbedo:))]
#[unsafe(method_family = none)]
pub unsafe fn setGroundAlbedo(&self, ground_albedo: c_float);
#[unsafe(method(horizonElevation))]
#[unsafe(method_family = none)]
pub unsafe fn horizonElevation(&self) -> c_float;
/// Setter for [`horizonElevation`][Self::horizonElevation].
#[unsafe(method(setHorizonElevation:))]
#[unsafe(method_family = none)]
pub unsafe fn setHorizonElevation(&self, horizon_elevation: c_float);
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(groundColor))]
#[unsafe(method_family = none)]
pub unsafe fn groundColor(&self) -> Option<Retained<CGColor>>;
#[cfg(feature = "objc2-core-graphics")]
/// Setter for [`groundColor`][Self::groundColor].
#[unsafe(method(setGroundColor:))]
#[unsafe(method_family = none)]
pub unsafe fn setGroundColor(&self, ground_color: Option<&CGColor>);
#[unsafe(method(gamma))]
#[unsafe(method_family = none)]
pub unsafe fn gamma(&self) -> c_float;
/// Setter for [`gamma`][Self::gamma].
#[unsafe(method(setGamma:))]
#[unsafe(method_family = none)]
pub unsafe fn setGamma(&self, gamma: c_float);
#[unsafe(method(exposure))]
#[unsafe(method_family = none)]
pub unsafe fn exposure(&self) -> c_float;
/// Setter for [`exposure`][Self::exposure].
#[unsafe(method(setExposure:))]
#[unsafe(method_family = none)]
pub unsafe fn setExposure(&self, exposure: c_float);
#[unsafe(method(brightness))]
#[unsafe(method_family = none)]
pub unsafe fn brightness(&self) -> c_float;
/// Setter for [`brightness`][Self::brightness].
#[unsafe(method(setBrightness:))]
#[unsafe(method_family = none)]
pub unsafe fn setBrightness(&self, brightness: c_float);
#[unsafe(method(contrast))]
#[unsafe(method_family = none)]
pub unsafe fn contrast(&self) -> c_float;
/// Setter for [`contrast`][Self::contrast].
#[unsafe(method(setContrast:))]
#[unsafe(method_family = none)]
pub unsafe fn setContrast(&self, contrast: c_float);
#[unsafe(method(saturation))]
#[unsafe(method_family = none)]
pub unsafe fn saturation(&self) -> c_float;
/// Setter for [`saturation`][Self::saturation].
#[unsafe(method(setSaturation:))]
#[unsafe(method_family = none)]
pub unsafe fn setSaturation(&self, saturation: c_float);
);
}
/// Methods declared on superclass `MDLTexture`.
impl MDLSkyCubeTexture {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a texture from a source in the main bundle named in a manner matching
/// name.
#[unsafe(method(textureNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed(name: &NSString) -> Option<Retained<Self>>;
#[unsafe(method(textureNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_bundle(
name: &NSString,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLAssetResolver")]
#[unsafe(method(textureNamed:assetResolver:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_assetResolver(
name: &NSString,
resolver: &ProtocolObject<dyn MDLAssetResolver>,
) -> Option<Retained<Self>>;
/// Creates a cube texture map image using 6 faces of the same dimensions,
/// ordered +X,-X,+Y,-Y,+Z,-Z If the data is read back the image will be compacted
/// into a single vertical stack where dimensions.y = 6 * dimensions.x
/// isCube will return YES
///
///
/// Parameter `names`: a collection of mosaiced images in a cross formation or column or row.
/// - If 6 individual images are given they are assumed to be in order and will be
/// loaded as is.
/// - if 3 images of double height or width are given they will be treated as
/// pairs of + and - in each axis, the order is must be x, then y, then z.
/// - if 2 images of triple height or width are given they will be treates as a
/// positive set and a negative set in the order +x, +y, +z, then -x, -y, -z.
/// - if a single image is given it will be used without conversion if in column
/// orientation and demosaiced in all other instances.
#[unsafe(method(textureCubeWithImagesNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed(
names: &NSArray<NSString>,
) -> Option<Retained<Self>>;
#[unsafe(method(textureCubeWithImagesNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed_bundle(
names: &NSArray<NSString>,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `NSObject`.
impl MDLSkyCubeTexture {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlcolorswatchtexture?language=objc)
#[unsafe(super(MDLTexture, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLColorSwatchTexture;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLColorSwatchTexture {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLColorSwatchTexture {}
);
impl MDLColorSwatchTexture {
extern_methods!();
}
/// Methods declared on superclass `MDLTexture`.
impl MDLColorSwatchTexture {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a texture from a source in the main bundle named in a manner matching
/// name.
#[unsafe(method(textureNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed(name: &NSString) -> Option<Retained<Self>>;
#[unsafe(method(textureNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_bundle(
name: &NSString,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLAssetResolver")]
#[unsafe(method(textureNamed:assetResolver:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_assetResolver(
name: &NSString,
resolver: &ProtocolObject<dyn MDLAssetResolver>,
) -> Option<Retained<Self>>;
/// Creates a cube texture map image using 6 faces of the same dimensions,
/// ordered +X,-X,+Y,-Y,+Z,-Z If the data is read back the image will be compacted
/// into a single vertical stack where dimensions.y = 6 * dimensions.x
/// isCube will return YES
///
///
/// Parameter `names`: a collection of mosaiced images in a cross formation or column or row.
/// - If 6 individual images are given they are assumed to be in order and will be
/// loaded as is.
/// - if 3 images of double height or width are given they will be treated as
/// pairs of + and - in each axis, the order is must be x, then y, then z.
/// - if 2 images of triple height or width are given they will be treates as a
/// positive set and a negative set in the order +x, +y, +z, then -x, -y, -z.
/// - if a single image is given it will be used without conversion if in column
/// orientation and demosaiced in all other instances.
#[unsafe(method(textureCubeWithImagesNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed(
names: &NSArray<NSString>,
) -> Option<Retained<Self>>;
#[unsafe(method(textureCubeWithImagesNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed_bundle(
names: &NSArray<NSString>,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `NSObject`.
impl MDLColorSwatchTexture {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// MDLNoiseTexture
/// a noise texture containing vector or scalar noise
///
/// the texture will be created if data is referenced, otherwise, this
/// object is merely a description
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlnoisetexture?language=objc)
#[unsafe(super(MDLTexture, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLNoiseTexture;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLNoiseTexture {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLNoiseTexture {}
);
impl MDLNoiseTexture {
extern_methods!();
}
/// Methods declared on superclass `MDLTexture`.
impl MDLNoiseTexture {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a texture from a source in the main bundle named in a manner matching
/// name.
#[unsafe(method(textureNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed(name: &NSString) -> Option<Retained<Self>>;
#[unsafe(method(textureNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_bundle(
name: &NSString,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLAssetResolver")]
#[unsafe(method(textureNamed:assetResolver:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_assetResolver(
name: &NSString,
resolver: &ProtocolObject<dyn MDLAssetResolver>,
) -> Option<Retained<Self>>;
/// Creates a cube texture map image using 6 faces of the same dimensions,
/// ordered +X,-X,+Y,-Y,+Z,-Z If the data is read back the image will be compacted
/// into a single vertical stack where dimensions.y = 6 * dimensions.x
/// isCube will return YES
///
///
/// Parameter `names`: a collection of mosaiced images in a cross formation or column or row.
/// - If 6 individual images are given they are assumed to be in order and will be
/// loaded as is.
/// - if 3 images of double height or width are given they will be treated as
/// pairs of + and - in each axis, the order is must be x, then y, then z.
/// - if 2 images of triple height or width are given they will be treates as a
/// positive set and a negative set in the order +x, +y, +z, then -x, -y, -z.
/// - if a single image is given it will be used without conversion if in column
/// orientation and demosaiced in all other instances.
#[unsafe(method(textureCubeWithImagesNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed(
names: &NSArray<NSString>,
) -> Option<Retained<Self>>;
#[unsafe(method(textureCubeWithImagesNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed_bundle(
names: &NSArray<NSString>,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `NSObject`.
impl MDLNoiseTexture {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlnormalmaptexture?language=objc)
#[unsafe(super(MDLTexture, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLNormalMapTexture;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLNormalMapTexture {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLNormalMapTexture {}
);
impl MDLNormalMapTexture {
extern_methods!(
#[unsafe(method(initByGeneratingNormalMapWithTexture:name:smoothness:contrast:))]
#[unsafe(method_family = init)]
pub unsafe fn initByGeneratingNormalMapWithTexture_name_smoothness_contrast(
this: Allocated<Self>,
source_texture: &MDLTexture,
name: Option<&NSString>,
smoothness: c_float,
contrast: c_float,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `MDLTexture`.
impl MDLNormalMapTexture {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a texture from a source in the main bundle named in a manner matching
/// name.
#[unsafe(method(textureNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed(name: &NSString) -> Option<Retained<Self>>;
#[unsafe(method(textureNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_bundle(
name: &NSString,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLAssetResolver")]
#[unsafe(method(textureNamed:assetResolver:))]
#[unsafe(method_family = none)]
pub unsafe fn textureNamed_assetResolver(
name: &NSString,
resolver: &ProtocolObject<dyn MDLAssetResolver>,
) -> Option<Retained<Self>>;
/// Creates a cube texture map image using 6 faces of the same dimensions,
/// ordered +X,-X,+Y,-Y,+Z,-Z If the data is read back the image will be compacted
/// into a single vertical stack where dimensions.y = 6 * dimensions.x
/// isCube will return YES
///
///
/// Parameter `names`: a collection of mosaiced images in a cross formation or column or row.
/// - If 6 individual images are given they are assumed to be in order and will be
/// loaded as is.
/// - if 3 images of double height or width are given they will be treated as
/// pairs of + and - in each axis, the order is must be x, then y, then z.
/// - if 2 images of triple height or width are given they will be treates as a
/// positive set and a negative set in the order +x, +y, +z, then -x, -y, -z.
/// - if a single image is given it will be used without conversion if in column
/// orientation and demosaiced in all other instances.
#[unsafe(method(textureCubeWithImagesNamed:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed(
names: &NSArray<NSString>,
) -> Option<Retained<Self>>;
#[unsafe(method(textureCubeWithImagesNamed:bundle:))]
#[unsafe(method_family = none)]
pub unsafe fn textureCubeWithImagesNamed_bundle(
names: &NSArray<NSString>,
bundle_or_nil: Option<&NSBundle>,
) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `NSObject`.
impl MDLNormalMapTexture {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}