Skip to content

Commit 78ca87c

Browse files
committed
Implement macOS view, view controller, storyboard and renderer changes.
Add all relevant files to mac target.
1 parent 1e12f8f commit 78ca87c

File tree

17 files changed

+320
-142
lines changed

17 files changed

+320
-142
lines changed

objc/06-Texturing/Texturing-Mac/Base.lproj/Main.storyboard

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
4+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
5+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
56
</dependencies>
67
<scenes>
78
<!--Application-->
@@ -673,7 +674,7 @@
673674
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
674675
</connections>
675676
</application>
676-
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider=""/>
677+
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
677678
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
678679
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
679680
</objects>
@@ -688,7 +689,7 @@
688689
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
689690
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
690691
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
691-
<connections>
692+
<connections>
692693
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
693694
</connections>
694695
</window>
@@ -703,8 +704,8 @@
703704
<!--View Controller-->
704705
<scene sceneID="hIz-AP-VOD">
705706
<objects>
706-
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
707-
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
707+
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
708+
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl" customClass="MBEMetalViewMac">
708709
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
709710
<autoresizingMask key="autoresizingMask"/>
710711
</view>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// MBEMetalViewMac.h
3+
// DrawingIn3D-Mac
4+
//
5+
// Created by Brent Gulanowski on 2018-06-18.
6+
// Copyright © 2018 Metal by Example. All rights reserved.
7+
//
8+
9+
@import Cocoa;
10+
11+
#import "MBEMetalView.h"
12+
13+
@interface MBEMetalViewMac : MBEMetalView
14+
15+
@end
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//
2+
// MBEMetalViewMac.m
3+
// DrawingIn3D-Mac
4+
//
5+
// Created by Brent Gulanowski on 2018-06-18.
6+
// Copyright © 2018 Metal by Example. All rights reserved.
7+
//
8+
9+
#import "MBEMetalViewMac.h"
10+
11+
@interface MBEMetalViewMac()
12+
@property (nonatomic) CVDisplayLinkRef displayLink;
13+
@property (nonatomic, strong) CAMetalLayer *metalLayer;
14+
@end
15+
16+
static NSTimeInterval C3DTimeIntervalFromTimeStamp(const CVTimeStamp *timeStamp) {
17+
return 1.0 / (timeStamp->rateScalar * (double)timeStamp->videoTimeScale / (double)timeStamp->videoRefreshPeriod);
18+
}
19+
20+
static CVReturn C3DViewDisplayLink(CVDisplayLinkRef displayLink,
21+
const CVTimeStamp *inNow,
22+
const CVTimeStamp *inOutputTime,
23+
CVOptionFlags flagsIn,
24+
CVOptionFlags *flagsOut,
25+
void *view) {
26+
@autoreleasepool {
27+
[(__bridge MBEMetalView *)view renderWithDuration:C3DTimeIntervalFromTimeStamp(inOutputTime)];
28+
}
29+
30+
return kCVReturnSuccess;
31+
}
32+
33+
@implementation MBEMetalViewMac
34+
35+
@synthesize metalLayer=_metalLayer;
36+
37+
- (CALayer *)makeBackingLayer
38+
{
39+
CAMetalLayer *layer = [[CAMetalLayer alloc] init];
40+
_metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm;
41+
_metalLayer = layer;
42+
return layer;
43+
}
44+
45+
- (CGSize)drawableSize {
46+
return self.bounds.size;
47+
}
48+
49+
- (void)viewDidMoveToSuperview
50+
{
51+
[super viewDidMoveToSuperview];
52+
53+
if (self.metalLayer.device == nil) {
54+
self.metalLayer.device = MTLCreateSystemDefaultDevice();
55+
}
56+
if (self.depthTexture == nil) {
57+
[self makeDepthTexture];
58+
}
59+
60+
if (self.superview) {
61+
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
62+
CVDisplayLinkSetOutputCallback(_displayLink, C3DViewDisplayLink, (__bridge void *)(self));
63+
CVDisplayLinkStart(_displayLink);
64+
}
65+
else {
66+
CVDisplayLinkStop(_displayLink);
67+
CVDisplayLinkRelease(_displayLink);
68+
_displayLink = NULL;
69+
}
70+
}
71+
72+
@end

objc/06-Texturing/Texturing-Mac/ViewController.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

objc/06-Texturing/Texturing-Mac/ViewController.m

Lines changed: 0 additions & 27 deletions
This file was deleted.

objc/06-Texturing/Texturing.xcodeproj/project.pbxproj

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,25 @@
2727
839E19191BE3583B00944528 /* Shaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 839E19181BE3583B00944528 /* Shaders.metal */; };
2828
839E191C1BE3596D00944528 /* MBETextureLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E191B1BE3596D00944528 /* MBETextureLoader.m */; };
2929
8451833420D918BA00BF473E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8451833320D918BA00BF473E /* AppDelegate.m */; };
30-
8451833720D918BA00BF473E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8451833620D918BA00BF473E /* ViewController.m */; };
3130
8451833920D918BB00BF473E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8451833820D918BB00BF473E /* Assets.xcassets */; };
3231
8451833C20D918BB00BF473E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8451833A20D918BB00BF473E /* Main.storyboard */; };
3332
8451833F20D918BB00BF473E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8451833E20D918BB00BF473E /* main.m */; };
33+
8451834420D919E200BF473E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E18DA1BE348B800944528 /* ViewController.m */; };
34+
8451834520D919F100BF473E /* moo.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 839E19041BE349AC00944528 /* moo.aiff */; };
35+
8451834620D91A6E00BF473E /* spot.obj in Resources */ = {isa = PBXBuildFile; fileRef = 839E19061BE349AC00944528 /* spot.obj */; };
36+
8451834720D91A7A00BF473E /* spot_texture.png in Resources */ = {isa = PBXBuildFile; fileRef = 839E19091BE349AD00944528 /* spot_texture.png */; };
37+
8451834820D91A9300BF473E /* MBEMathUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E18EB1BE3495400944528 /* MBEMathUtilities.m */; };
38+
8451834920D91A9300BF473E /* MBEMaterial.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E19011BE3497A00944528 /* MBEMaterial.m */; };
39+
8451834A20D91A9300BF473E /* MBEMesh.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E18ED1BE3495400944528 /* MBEMesh.m */; };
40+
8451834B20D91A9300BF473E /* MBETextureLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E191B1BE3596D00944528 /* MBETextureLoader.m */; };
41+
8451834C20D91A9300BF473E /* MBEOBJGroup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 839E18F11BE3495400944528 /* MBEOBJGroup.mm */; };
42+
8451834D20D91A9300BF473E /* MBEOBJMesh.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E18F31BE3495400944528 /* MBEOBJMesh.m */; };
43+
8451834E20D91A9300BF473E /* MBEOBJModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 839E18F51BE3495400944528 /* MBEOBJModel.mm */; };
44+
8451834F20D91A9300BF473E /* MBERenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E18F71BE3495400944528 /* MBERenderer.m */; };
45+
8451835020D91A9E00BF473E /* Shaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 839E19181BE3583B00944528 /* Shaders.metal */; };
46+
8451835320D91D9700BF473E /* MBEMetalViewMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 8451835220D91D9700BF473E /* MBEMetalViewMac.m */; };
47+
8451835420D91DAF00BF473E /* MBEMetalView.m in Sources */ = {isa = PBXBuildFile; fileRef = 839E18EF1BE3495400944528 /* MBEMetalView.m */; };
48+
845183AF20D970FF00BF473E /* MBEMetalViewIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = 845183AE20D970FF00BF473E /* MBEMetalViewIOS.m */; };
3449
/* End PBXBuildFile section */
3550

3651
/* Begin PBXFileReference section */
@@ -75,13 +90,15 @@
7590
8451833020D918BA00BF473E /* Texturing.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Texturing.app; sourceTree = BUILT_PRODUCTS_DIR; };
7691
8451833220D918BA00BF473E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7792
8451833320D918BA00BF473E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
78-
8451833520D918BA00BF473E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
79-
8451833620D918BA00BF473E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
8093
8451833820D918BB00BF473E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8194
8451833B20D918BB00BF473E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8295
8451833D20D918BB00BF473E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8396
8451833E20D918BB00BF473E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8497
8451834020D918BB00BF473E /* Texturing_Mac.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Texturing_Mac.entitlements; sourceTree = "<group>"; };
98+
8451835120D91D9700BF473E /* MBEMetalViewMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBEMetalViewMac.h; sourceTree = "<group>"; };
99+
8451835220D91D9700BF473E /* MBEMetalViewMac.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBEMetalViewMac.m; sourceTree = "<group>"; };
100+
845183AD20D970FE00BF473E /* MBEMetalViewIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBEMetalViewIOS.h; sourceTree = "<group>"; };
101+
845183AE20D970FF00BF473E /* MBEMetalViewIOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBEMetalViewIOS.m; sourceTree = "<group>"; };
85102
/* End PBXFileReference section */
86103

87104
/* Begin PBXFrameworksBuildPhase section */
@@ -123,17 +140,22 @@
123140
839E18D21BE348B800944528 /* Texturing */ = {
124141
isa = PBXGroup;
125142
children = (
126-
839E19031BE349AC00944528 /* spot */,
127-
839E18EA1BE3495400944528 /* MBEMathUtilities.h */,
128-
839E18EB1BE3495400944528 /* MBEMathUtilities.m */,
143+
839E18D61BE348B800944528 /* AppDelegate.h */,
144+
839E18D71BE348B800944528 /* AppDelegate.m */,
145+
839E18DF1BE348B800944528 /* Assets.xcassets */,
146+
839E18E41BE348B800944528 /* Info.plist */,
147+
839E18E11BE348B800944528 /* LaunchScreen.storyboard */,
148+
839E18DC1BE348B800944528 /* Main.storyboard */,
129149
839E19001BE3497A00944528 /* MBEMaterial.h */,
130150
839E19011BE3497A00944528 /* MBEMaterial.m */,
151+
839E18EA1BE3495400944528 /* MBEMathUtilities.h */,
152+
839E18EB1BE3495400944528 /* MBEMathUtilities.m */,
131153
839E18EC1BE3495400944528 /* MBEMesh.h */,
132154
839E18ED1BE3495400944528 /* MBEMesh.m */,
133155
839E18EE1BE3495400944528 /* MBEMetalView.h */,
134156
839E18EF1BE3495400944528 /* MBEMetalView.m */,
135-
839E191A1BE3596D00944528 /* MBETextureLoader.h */,
136-
839E191B1BE3596D00944528 /* MBETextureLoader.m */,
157+
845183AD20D970FE00BF473E /* MBEMetalViewIOS.h */,
158+
845183AE20D970FF00BF473E /* MBEMetalViewIOS.m */,
137159
839E18F01BE3495400944528 /* MBEOBJGroup.h */,
138160
839E18F11BE3495400944528 /* MBEOBJGroup.mm */,
139161
839E18F21BE3495400944528 /* MBEOBJMesh.h */,
@@ -142,17 +164,14 @@
142164
839E18F51BE3495400944528 /* MBEOBJModel.mm */,
143165
839E18F61BE3495400944528 /* MBERenderer.h */,
144166
839E18F71BE3495400944528 /* MBERenderer.m */,
167+
839E191A1BE3596D00944528 /* MBETextureLoader.h */,
168+
839E191B1BE3596D00944528 /* MBETextureLoader.m */,
145169
839E18F81BE3495400944528 /* MBETypes.h */,
146-
839E18D61BE348B800944528 /* AppDelegate.h */,
147-
839E18D71BE348B800944528 /* AppDelegate.m */,
148-
839E18D91BE348B800944528 /* ViewController.h */,
149-
839E18DA1BE348B800944528 /* ViewController.m */,
150170
839E19181BE3583B00944528 /* Shaders.metal */,
151-
839E18DC1BE348B800944528 /* Main.storyboard */,
152-
839E18DF1BE348B800944528 /* Assets.xcassets */,
153-
839E18E11BE348B800944528 /* LaunchScreen.storyboard */,
154-
839E18E41BE348B800944528 /* Info.plist */,
171+
839E19031BE349AC00944528 /* spot */,
155172
839E18D31BE348B800944528 /* Supporting Files */,
173+
839E18D91BE348B800944528 /* ViewController.h */,
174+
839E18DA1BE348B800944528 /* ViewController.m */,
156175
);
157176
path = Texturing;
158177
sourceTree = "<group>";
@@ -185,12 +204,12 @@
185204
children = (
186205
8451833220D918BA00BF473E /* AppDelegate.h */,
187206
8451833320D918BA00BF473E /* AppDelegate.m */,
188-
8451833520D918BA00BF473E /* ViewController.h */,
189-
8451833620D918BA00BF473E /* ViewController.m */,
190207
8451833820D918BB00BF473E /* Assets.xcassets */,
191-
8451833A20D918BB00BF473E /* Main.storyboard */,
192208
8451833D20D918BB00BF473E /* Info.plist */,
193209
8451833E20D918BB00BF473E /* main.m */,
210+
8451833A20D918BB00BF473E /* Main.storyboard */,
211+
8451835120D91D9700BF473E /* MBEMetalViewMac.h */,
212+
8451835220D91D9700BF473E /* MBEMetalViewMac.m */,
194213
8451834020D918BB00BF473E /* Texturing_Mac.entitlements */,
195214
);
196215
path = "Texturing-Mac";
@@ -288,8 +307,11 @@
288307
isa = PBXResourcesBuildPhase;
289308
buildActionMask = 2147483647;
290309
files = (
310+
8451834720D91A7A00BF473E /* spot_texture.png in Resources */,
311+
8451834620D91A6E00BF473E /* spot.obj in Resources */,
291312
8451833920D918BB00BF473E /* Assets.xcassets in Resources */,
292313
8451833C20D918BB00BF473E /* Main.storyboard in Resources */,
314+
8451834520D919F100BF473E /* moo.aiff in Resources */,
293315
);
294316
runOnlyForDeploymentPostprocessing = 0;
295317
};
@@ -313,16 +335,28 @@
313335
839E18F91BE3495400944528 /* MBEMathUtilities.m in Sources */,
314336
839E18FF1BE3495400944528 /* MBERenderer.m in Sources */,
315337
839E18FA1BE3495400944528 /* MBEMesh.m in Sources */,
338+
845183AF20D970FF00BF473E /* MBEMetalViewIOS.m in Sources */,
316339
);
317340
runOnlyForDeploymentPostprocessing = 0;
318341
};
319342
8451832C20D918BA00BF473E /* Sources */ = {
320343
isa = PBXSourcesBuildPhase;
321344
buildActionMask = 2147483647;
322345
files = (
323-
8451833720D918BA00BF473E /* ViewController.m in Sources */,
346+
8451835020D91A9E00BF473E /* Shaders.metal in Sources */,
347+
8451835420D91DAF00BF473E /* MBEMetalView.m in Sources */,
348+
8451834F20D91A9300BF473E /* MBERenderer.m in Sources */,
349+
8451834920D91A9300BF473E /* MBEMaterial.m in Sources */,
350+
8451834420D919E200BF473E /* ViewController.m in Sources */,
351+
8451834C20D91A9300BF473E /* MBEOBJGroup.mm in Sources */,
324352
8451833F20D918BB00BF473E /* main.m in Sources */,
353+
8451834E20D91A9300BF473E /* MBEOBJModel.mm in Sources */,
325354
8451833420D918BA00BF473E /* AppDelegate.m in Sources */,
355+
8451834820D91A9300BF473E /* MBEMathUtilities.m in Sources */,
356+
8451835320D91D9700BF473E /* MBEMetalViewMac.m in Sources */,
357+
8451834B20D91A9300BF473E /* MBETextureLoader.m in Sources */,
358+
8451834A20D91A9300BF473E /* MBEMesh.m in Sources */,
359+
8451834D20D91A9300BF473E /* MBEOBJMesh.m in Sources */,
326360
);
327361
runOnlyForDeploymentPostprocessing = 0;
328362
};

objc/06-Texturing/Texturing/Base.lproj/Main.storyboard

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
47
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
610
</dependencies>
711
<scenes>
812
<!--View Controller-->
@@ -13,11 +17,10 @@
1317
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
1418
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
1519
</layoutGuides>
16-
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="MBEMetalView">
17-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
20+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="MBEMetalViewIOS">
21+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1822
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19-
<animations/>
20-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
23+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2124
</view>
2225
</viewController>
2326
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>

objc/06-Texturing/Texturing/MBEMesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import UIKit;
1+
@import Foundation;
22
@import Metal;
33

44
@interface MBEMesh : NSObject

objc/06-Texturing/Texturing/MBEMetalView.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
#import <TargetConditionals.h>
2+
3+
#if TARGET_OS_IPHONE
14
@import UIKit;
5+
#define NSUIView UIView;
6+
#else
7+
@import AppKit;
8+
#define NSUIView NSView;
9+
#endif
210
@import Metal;
311
@import QuartzCore.CAMetalLayer;
412

513
@protocol MBEMetalViewDelegate;
614

7-
@interface MBEMetalView : UIView
15+
@interface MBEMetalView : NSUIView
816

917
/// The delegate of this view, responsible for drawing
1018
@property (nonatomic, weak) id<MBEMetalViewDelegate> delegate;
@@ -36,6 +44,14 @@
3644
/// size as its depth attachment's texture
3745
@property (nonatomic, readonly) MTLRenderPassDescriptor *currentRenderPassDescriptor;
3846

47+
@property (strong) id<MTLTexture> depthTexture;
48+
49+
// Subclass override points
50+
@property (nonatomic, readonly) CGSize drawableSize;
51+
52+
- (void)makeDepthTexture;
53+
- (void)renderWithDuration:(NSTimeInterval)duration;
54+
3955
@end
4056

4157
@protocol MBEMetalViewDelegate <NSObject>

0 commit comments

Comments
 (0)