mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-26 21:40:07 +00:00
Mtl implementation example options
Updated the Metal viewer runtime options to more closely match the other viewers: - default to adaptive tessellation - default to patch type coloring - present end cap options as: Linear/Regular/Gregory - exposed switches for patch refinement options: smooth corner, single crease, inf sharp - updated fvar linear interpolation labels and methods to match glFVarViewer - updated iOS Main.storyboard GUI to match
This commit is contained in:
parent
ebf2917dc7
commit
ed8ecd84d1
@ -38,8 +38,9 @@ enum {
|
||||
kHUD_CB_FRACTIONAL_SPACING,
|
||||
kHUD_CB_PATCH_CULL,
|
||||
kHUD_CB_BACK_CULL,
|
||||
kHUD_CB_PATCH_INDIRECT_CULL,
|
||||
kHUD_CB_PATCH_INDEX_BUFFER,
|
||||
kHUD_CB_FREEZE,
|
||||
kHUD_CB_SMOOTH_CORNER_PATCH,
|
||||
kHUD_CB_SINGLE_CREASE_PATCH,
|
||||
kHUD_CB_INFINITE_SHARP_PATCH,
|
||||
kHUD_CB_ADAPTIVE,
|
||||
@ -87,9 +88,9 @@ enum {
|
||||
-(void)keyDown:(NSEvent *)event {
|
||||
const auto key = [event.charactersIgnoringModifiers characterAtIndex:0];
|
||||
if(key == '=') {
|
||||
_controller.osdRenderer.tessellationLevel = std::min(_controller.osdRenderer.tessellationLevel + 1, 16.0f);
|
||||
_controller.osdRenderer.tessellationLevel = std::min(_controller.osdRenderer.tessellationLevel + 1, 16);
|
||||
} else if (key == '-') {
|
||||
_controller.osdRenderer.tessellationLevel = std::max(_controller.osdRenderer.tessellationLevel - 1, 0.0f);
|
||||
_controller.osdRenderer.tessellationLevel = std::max(_controller.osdRenderer.tessellationLevel - 1, 0);
|
||||
} else if(!hud.KeyDown(key))
|
||||
[super keyDown:event];
|
||||
}
|
||||
@ -172,8 +173,11 @@ enum {
|
||||
case kHUD_CB_FRACTIONAL_SPACING:
|
||||
self.osdRenderer.useFractionalTessellation = value;
|
||||
break;
|
||||
case kHUD_CB_SMOOTH_CORNER_PATCH:
|
||||
self.osdRenderer.useSmoothCornerPatch = value;
|
||||
break;
|
||||
case kHUD_CB_SINGLE_CREASE_PATCH:
|
||||
self.osdRenderer.useSingleCrease = value;
|
||||
self.osdRenderer.useSingleCreasePatch = value;
|
||||
break;
|
||||
case kHUD_CB_DISPLAY_CONTROL_MESH_EDGES:
|
||||
self.osdRenderer.displayControlMeshEdges = value;
|
||||
@ -185,7 +189,7 @@ enum {
|
||||
self.osdRenderer.usePatchBackfaceCulling = value;
|
||||
self.osdRenderer.usePrimitiveBackfaceCulling = value;
|
||||
break;
|
||||
case kHUD_CB_PATCH_INDIRECT_CULL:
|
||||
case kHUD_CB_PATCH_INDEX_BUFFER:
|
||||
self.osdRenderer.usePatchIndexBuffer = value;
|
||||
break;
|
||||
case kHUD_CB_ADAPTIVE:
|
||||
@ -213,15 +217,15 @@ enum {
|
||||
}
|
||||
};
|
||||
|
||||
auto callbackBoundary = [=](int boundaryType) {
|
||||
switch((FVarBoundary)boundaryType) {
|
||||
auto callbackFVarLinearInterp = [=](int fVarLinearInterp) {
|
||||
switch((FVarLinearInterp)fVarLinearInterp) {
|
||||
case kFVarLinearNone:
|
||||
case kFVarLinearCornersOnly:
|
||||
case kFVarLinearCornersPlus1:
|
||||
case kFVarLinearCornersPlus2:
|
||||
case kFVarLinearBoundaries:
|
||||
case kFVarLinearAll:
|
||||
self.osdRenderer.fVarBoundary = (FVarBoundary)boundaryType;
|
||||
self.osdRenderer.fVarLinearInterp = (FVarLinearInterp)fVarLinearInterp;
|
||||
}
|
||||
};
|
||||
|
||||
@ -239,11 +243,12 @@ enum {
|
||||
|
||||
auto callbackShadingMode = [=](int shadingMode) {
|
||||
switch((ShadingMode)shadingMode) {
|
||||
case kShadingNormal:
|
||||
case kShadingMaterial:
|
||||
case kShadingFaceVaryingColor:
|
||||
case kShadingPatchType:
|
||||
case kShadingPatchDepth:
|
||||
case kShadingPatchCoord:
|
||||
case kShadingFaceVarying:
|
||||
case kShadingNormal:
|
||||
self.osdRenderer.shadingMode = (ShadingMode)shadingMode;
|
||||
break;
|
||||
default:
|
||||
@ -253,7 +258,7 @@ enum {
|
||||
|
||||
auto callbackEndCap = [=](int endCap) {
|
||||
switch((EndCap)endCap) {
|
||||
case kEndCapNone:
|
||||
case kEndCapBilinearBasis:
|
||||
case kEndCapBSplineBasis:
|
||||
case kEndCapGregoryBasis:
|
||||
case kEndCapLegacyGregory:
|
||||
@ -298,12 +303,12 @@ enum {
|
||||
hud.AddCheckBox("Frustum Patch Culling (F)", _osdRenderer.usePatchClipCulling,
|
||||
10, y, callbackCheckbox, kHUD_CB_PATCH_CULL, 'f');
|
||||
y += 20;
|
||||
hud.AddCheckBox("Backface Culling (L)", _osdRenderer.usePatchBackfaceCulling,
|
||||
10, y, callbackCheckbox, kHUD_CB_BACK_CULL, 'l');
|
||||
hud.AddCheckBox("Backface Culling (B)", _osdRenderer.usePatchBackfaceCulling,
|
||||
10, y, callbackCheckbox, kHUD_CB_BACK_CULL, 'b');
|
||||
|
||||
y += 20;
|
||||
hud.AddCheckBox("Patch Index Culling (O)", _osdRenderer.usePatchIndexBuffer,
|
||||
10, y, callbackCheckbox, kHUD_CB_PATCH_INDIRECT_CULL, 'o');
|
||||
hud.AddCheckBox("Patch Index Buffer (D)", _osdRenderer.usePatchIndexBuffer,
|
||||
10, y, callbackCheckbox, kHUD_CB_PATCH_INDEX_BUFFER, 'd');
|
||||
|
||||
y += 20;
|
||||
hud.AddCheckBox("Freeze (spc)", _osdRenderer.freeze,
|
||||
@ -325,65 +330,73 @@ enum {
|
||||
hud.AddPullDownButton(shading_pulldown, "Material",
|
||||
kShadingMaterial,
|
||||
_osdRenderer.shadingMode == kShadingMaterial);
|
||||
hud.AddPullDownButton(shading_pulldown, "FaceVarying Color",
|
||||
kShadingFaceVaryingColor,
|
||||
_osdRenderer.shadingMode == kShadingFaceVaryingColor);
|
||||
hud.AddPullDownButton(shading_pulldown, "Patch Type",
|
||||
kShadingPatchType,
|
||||
_osdRenderer.shadingMode == kShadingPatchType);
|
||||
hud.AddPullDownButton(shading_pulldown, "Patch Depth",
|
||||
kShadingPatchDepth,
|
||||
_osdRenderer.shadingMode == kShadingPatchDepth);
|
||||
hud.AddPullDownButton(shading_pulldown, "Patch Coord",
|
||||
kShadingPatchCoord,
|
||||
_osdRenderer.shadingMode == kShadingPatchCoord);
|
||||
hud.AddPullDownButton(shading_pulldown, "Normal",
|
||||
kShadingNormal,
|
||||
_osdRenderer.shadingMode == kShadingNormal);
|
||||
hud.AddPullDownButton(shading_pulldown, "Face Varying",
|
||||
kShadingFaceVarying,
|
||||
_osdRenderer.shadingMode == kShadingFaceVarying);
|
||||
|
||||
int compute_pulldown = hud.AddPullDown("Compute (K)", 475, 10, 175, callbackKernel, 'k');
|
||||
hud.AddPullDownButton(compute_pulldown, "CPU", kCPU, _osdRenderer.kernelType == kCPU);
|
||||
hud.AddPullDownButton(compute_pulldown, "Metal", kMetal, _osdRenderer.kernelType == kMetal);
|
||||
|
||||
int boundary_pulldown = hud.AddPullDown("Boundary (B)", 650, 10, 300, callbackBoundary, 'b');
|
||||
hud.AddPullDownButton(boundary_pulldown, "None (edge only)",
|
||||
int fVarLinearInterp_pulldown = hud.AddPullDown("FVar Linear Interpolation (L)",
|
||||
650, 10, 300, callbackFVarLinearInterp, 'l');
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "None (edge only)",
|
||||
kFVarLinearNone,
|
||||
_osdRenderer.fVarBoundary == kFVarLinearNone);
|
||||
hud.AddPullDownButton(boundary_pulldown, "Corners Only",
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearNone);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Corners Only",
|
||||
kFVarLinearCornersOnly,
|
||||
_osdRenderer.fVarBoundary == kFVarLinearCornersOnly);
|
||||
hud.AddPullDownButton(boundary_pulldown, "Corners 1 (edge corner)",
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearCornersOnly);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Corners 1 (edge corner)",
|
||||
kFVarLinearCornersPlus1,
|
||||
_osdRenderer.fVarBoundary == kFVarLinearCornersPlus1);
|
||||
hud.AddPullDownButton(boundary_pulldown, "Corners 2 (edge corner prop)",
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearCornersPlus1);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Corners 2 (edge corner prop)",
|
||||
kFVarLinearCornersPlus2,
|
||||
_osdRenderer.fVarBoundary == kFVarLinearCornersPlus2);
|
||||
hud.AddPullDownButton(boundary_pulldown, "Boundaries (always sharp)",
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearCornersPlus2);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Boundaries (always sharp)",
|
||||
kFVarLinearBoundaries,
|
||||
_osdRenderer.fVarBoundary == kFVarLinearBoundaries);
|
||||
hud.AddPullDownButton(boundary_pulldown, "All (bilinear)",
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearBoundaries);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "All (bilinear)",
|
||||
kFVarLinearAll,
|
||||
_osdRenderer.fVarBoundary == kFVarLinearAll);
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearAll);
|
||||
|
||||
{
|
||||
hud.AddCheckBox("Adaptive (`)", _osdRenderer.useAdaptive,
|
||||
10, 190, callbackCheckbox, kHUD_CB_ADAPTIVE, '`');
|
||||
hud.AddCheckBox("Single Crease Patch (S)", _osdRenderer.useSingleCrease,
|
||||
10, 210, callbackCheckbox, kHUD_CB_SINGLE_CREASE_PATCH, 's');
|
||||
hud.AddCheckBox("Smooth Corner Patch (O)", _osdRenderer.useSmoothCornerPatch,
|
||||
10, 210, callbackCheckbox, kHUD_CB_SMOOTH_CORNER_PATCH, 'o');
|
||||
hud.AddCheckBox("Single Crease Patch (S)", _osdRenderer.useSingleCreasePatch,
|
||||
10, 230, callbackCheckbox, kHUD_CB_SINGLE_CREASE_PATCH, 's');
|
||||
hud.AddCheckBox("Inf Sharp Patch (I)", _osdRenderer.useInfinitelySharpPatch,
|
||||
10, 230, callbackCheckbox, kHUD_CB_INFINITE_SHARP_PATCH, 'i');
|
||||
10, 250, callbackCheckbox, kHUD_CB_INFINITE_SHARP_PATCH, 'i');
|
||||
|
||||
int endcap_pulldown = hud.AddPullDown(
|
||||
"End cap (E)", 10, 250, 200, callbackEndCap, 'e');
|
||||
hud.AddPullDownButton(endcap_pulldown,"None",
|
||||
kEndCapNone,
|
||||
_osdRenderer.endCapMode == kEndCapNone);
|
||||
hud.AddPullDownButton(endcap_pulldown, "BSpline",
|
||||
"End cap (E)", 10, 270, 200, callbackEndCap, 'e');
|
||||
hud.AddPullDownButton(endcap_pulldown,"Linear",
|
||||
kEndCapBilinearBasis,
|
||||
_osdRenderer.endCapMode == kEndCapBilinearBasis);
|
||||
hud.AddPullDownButton(endcap_pulldown, "Regular",
|
||||
kEndCapBSplineBasis,
|
||||
_osdRenderer.endCapMode == kEndCapBSplineBasis);
|
||||
hud.AddPullDownButton(endcap_pulldown, "GregoryBasis",
|
||||
hud.AddPullDownButton(endcap_pulldown, "Gregory",
|
||||
kEndCapGregoryBasis,
|
||||
_osdRenderer.endCapMode == kEndCapGregoryBasis);
|
||||
hud.AddPullDownButton(endcap_pulldown, "LegacyGregory",
|
||||
kEndCapLegacyGregory,
|
||||
_osdRenderer.endCapMode == kEndCapLegacyGregory);
|
||||
if (true || _osdRenderer.legacyGregoryEnabled) {
|
||||
hud.AddPullDownButton(endcap_pulldown, "LegacyGregory",
|
||||
kEndCapLegacyGregory,
|
||||
_osdRenderer.endCapMode == kEndCapLegacyGregory);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < 11; ++i) {
|
||||
@ -397,7 +410,7 @@ enum {
|
||||
hud.AddPullDownButton(shapes_pulldown, _osdRenderer.loadedModels[i].UTF8String,i);
|
||||
}
|
||||
|
||||
hud.AddCheckBox("Show patch counts (,)", _showPatchCounts, -280, -20, callbackCheckbox, kHUD_CB_DISPLAY_PATCH_COUNTS, ',');
|
||||
hud.AddCheckBox("Show patch counts (,)", _showPatchCounts, -420, -20, callbackCheckbox, kHUD_CB_DISPLAY_PATCH_COUNTS, ',');
|
||||
|
||||
hud.Rebuild(self.view.bounds.size.width, self.view.bounds.size.height, self.view.drawableSize.width, self.view.drawableSize.height);
|
||||
}
|
||||
@ -416,21 +429,29 @@ enum {
|
||||
auto& hud = self.view->hud;
|
||||
if(hud.IsVisible()) {
|
||||
if(_showPatchCounts) {
|
||||
int x = -280;
|
||||
int x = -420;
|
||||
int y = -180;
|
||||
hud.DrawString(x, y, "NonPatch : %d",
|
||||
hud.DrawString(x, y, "Quads : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::QUADS]); y += 20;
|
||||
hud.DrawString(x, y, "Triangles : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::TRIANGLES]); y += 20;
|
||||
hud.DrawString(x, y, "Regular : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::REGULAR]); y+= 20;
|
||||
hud.DrawString(x, y, "Gregory : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::GREGORY]); y+= 20;
|
||||
hud.DrawString(x, y, "Boundary Gregory : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::GREGORY_BOUNDARY]); y+= 20;
|
||||
hud.DrawString(x, y, "Loop : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::LOOP]); y+= 20;
|
||||
if (_osdRenderer.legacyGregoryEnabled) {
|
||||
hud.DrawString(x, y, "Gregory : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::GREGORY]); y+= 20;
|
||||
hud.DrawString(x, y, "Boundary Gregory : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::GREGORY_BOUNDARY]); y+= 20;
|
||||
}
|
||||
hud.DrawString(x, y, "Gregory Basis : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::GREGORY_BASIS]); y+= 20;
|
||||
hud.DrawString(x, y, "Gregory Triangle : %d",
|
||||
_osdRenderer.patchCounts[Far::PatchDescriptor::GREGORY_TRIANGLE]); y+= 20;
|
||||
}
|
||||
|
||||
hud.DrawString(10, -120, "Tess level : %f", _osdRenderer.tessellationLevel);
|
||||
hud.DrawString(10, -120, "Tess level : %d", _osdRenderer.tessellationLevel);
|
||||
hud.DrawString(10, -20, "FPS = %3.1f", 1.0 / avg);
|
||||
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11147" systemVersion="16A201u" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="ipad9_7" orientation="landscape">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11119"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -16,15 +18,17 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="MTKView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1366" height="1024"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="1024" height="768"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Information Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ze8-2s-lED">
|
||||
<rect key="frame" x="20" y="40" width="133.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oQb-3T-gg6" userLabel="modelPickerView">
|
||||
<rect key="frame" x="809" y="646" width="195" height="102"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="195" id="Qn1-yQ-7c6"/>
|
||||
<constraint firstAttribute="height" constant="102" id="xJP-UH-SIl"/>
|
||||
@ -35,106 +39,114 @@
|
||||
</connections>
|
||||
</pickerView>
|
||||
<stepper opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minimumValue="1" maximumValue="5" translatesAutoresizingMaskIntoConstraints="NO" id="QQ6-5o-gla">
|
||||
<rect key="frame" x="910" y="511" width="94" height="29"/>
|
||||
<connections>
|
||||
<action selector="stepperChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="uHZ-dB-XZV"/>
|
||||
</connections>
|
||||
</stepper>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ref Lvl." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N12-GK-yLY">
|
||||
<rect key="frame" x="846.5" y="515.5" width="55.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stepper opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" maximumValue="16" translatesAutoresizingMaskIntoConstraints="NO" id="eYp-5M-Rgk">
|
||||
<rect key="frame" x="910" y="544" width="94" height="29"/>
|
||||
<connections>
|
||||
<action selector="stepperChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="mBg-38-OPM"/>
|
||||
</connections>
|
||||
</stepper>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="jQK-WK-vfP">
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="1" translatesAutoresizingMaskIntoConstraints="NO" id="jQK-WK-vfP">
|
||||
<rect key="frame" x="229.5" y="720" width="191" height="29"/>
|
||||
<segments>
|
||||
<segment title="BSpline"/>
|
||||
<segment title="Legacy Gregory"/>
|
||||
<segment title="Gregory Basis"/>
|
||||
<segment title="Linear"/>
|
||||
<segment title="Regular"/>
|
||||
<segment title="Gregory"/>
|
||||
</segments>
|
||||
<connections>
|
||||
<action selector="endcapChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="vBH-MZ-zYA"/>
|
||||
</connections>
|
||||
</segmentedControl>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="8kP-4Y-wzA">
|
||||
<rect key="frame" x="736" y="600" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="UsH-Nw-M31"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Wireframe" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FvR-NK-6s0" userLabel="Wireframe">
|
||||
<rect key="frame" x="648" y="605.5" width="80" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Backpatch Culling" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="esT-7h-XLG">
|
||||
<rect key="frame" x="590" y="644.5" width="138" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="P8z-O2-OLV">
|
||||
<rect key="frame" x="736" y="639" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="w7T-KH-L3E"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="5Ns-3P-r13">
|
||||
<rect key="frame" x="736" y="678" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="ym1-Xw-wU6"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="fw1-9C-P6U">
|
||||
<rect key="frame" x="736" y="717" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="8kp-Rh-Yua"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Backface Culling" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Iw4-VH-Zwm">
|
||||
<rect key="frame" x="600.5" y="683.5" width="127.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Patch Clip Culling" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5xP-bY-PgM">
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Single Crease" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kuw-3r-nzl">
|
||||
<rect key="frame" x="593.5" y="722.5" width="134.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7yA-a6-Sq7">
|
||||
<rect key="frame" x="524.5" y="681" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="Yg5-z5-avS"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Control Mesh" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cRi-2K-jkK">
|
||||
<rect key="frame" x="413.5" y="647.5" width="103" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Screenspace Tessellation" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ioY-T2-PEM">
|
||||
<rect key="frame" x="322.5" y="686.5" width="194" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tes Lvl." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dlx-hC-oDg">
|
||||
<rect key="frame" x="845.5" y="548.5" width="56.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sDC-ZC-b6I">
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="ebT-0s-gYR"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Ta2-7B-7Ck">
|
||||
<rect key="frame" x="524.5" y="642" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="PcJ-3J-UKL"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8Ky-iT-gpT">
|
||||
<rect key="frame" x="810" y="581" width="194" height="57"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="57" id="8qk-aN-q1z"/>
|
||||
<constraint firstAttribute="width" constant="194" id="aSF-hS-BWT"/>
|
||||
@ -144,6 +156,48 @@
|
||||
<outlet property="delegate" destination="BYZ-38-t0r" id="73C-8g-Biy"/>
|
||||
</connections>
|
||||
</pickerView>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xBi-mu-U3U">
|
||||
<rect key="frame" x="265" y="682" width="49" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="Ksb-v0-3jz"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Inf Sharp Patch" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vaI-nm-Fqf">
|
||||
<rect key="frame" x="137" y="686" width="118" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OEV-Vc-RmB">
|
||||
<rect key="frame" x="265" y="646" width="49" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="Bcz-Ql-hk2"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Single Crease Patch" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Emp-qG-6H3">
|
||||
<rect key="frame" x="101" y="650" width="154" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FZx-Rb-43j">
|
||||
<rect key="frame" x="265" y="609" width="49" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<connections>
|
||||
<action selector="switchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="3Rf-TS-afQ"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Smooth Corner Patch" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vyo-Y5-Nlh">
|
||||
<rect key="frame" x="90" y="613" width="165" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
@ -155,19 +209,16 @@
|
||||
<constraint firstItem="7yA-a6-Sq7" firstAttribute="trailing" secondItem="jQK-WK-vfP" secondAttribute="trailing" id="AnK-qT-Bca"/>
|
||||
<constraint firstItem="eYp-5M-Rgk" firstAttribute="leading" secondItem="dlx-hC-oDg" secondAttribute="trailing" constant="8" id="B0o-kO-368"/>
|
||||
<constraint firstItem="QQ6-5o-gla" firstAttribute="leading" secondItem="N12-GK-yLY" secondAttribute="trailing" constant="8" id="DrB-sY-inQ"/>
|
||||
<constraint firstItem="Ta2-7B-7Ck" firstAttribute="top" secondItem="sDC-ZC-b6I" secondAttribute="bottom" constant="8" id="EK0-Q5-QyW"/>
|
||||
<constraint firstItem="Ta2-7B-7Ck" firstAttribute="leading" secondItem="cRi-2K-jkK" secondAttribute="trailing" constant="8" id="En4-Ve-B3K"/>
|
||||
<constraint firstItem="8Ky-iT-gpT" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="HnT-dY-hLh"/>
|
||||
<constraint firstItem="oQb-3T-gg6" firstAttribute="leading" secondItem="fw1-9C-P6U" secondAttribute="trailing" constant="24" id="JmG-em-jfy"/>
|
||||
<constraint firstItem="7yA-a6-Sq7" firstAttribute="top" secondItem="Ta2-7B-7Ck" secondAttribute="bottom" constant="8" id="O1O-AY-rOc"/>
|
||||
<constraint firstItem="Ta2-7B-7Ck" firstAttribute="centerY" secondItem="cRi-2K-jkK" secondAttribute="centerY" id="OGy-au-4ty"/>
|
||||
<constraint firstItem="sDC-ZC-b6I" firstAttribute="trailing" secondItem="jQK-WK-vfP" secondAttribute="trailing" id="OLn-EQ-Ol5"/>
|
||||
<constraint firstItem="P8z-O2-OLV" firstAttribute="centerY" secondItem="esT-7h-XLG" secondAttribute="centerY" id="Oxf-2f-wTD"/>
|
||||
<constraint firstItem="eYp-5M-Rgk" firstAttribute="top" secondItem="QQ6-5o-gla" secondAttribute="bottom" constant="4" id="PJS-Lq-bIL"/>
|
||||
<constraint firstItem="Ta2-7B-7Ck" firstAttribute="trailing" secondItem="jQK-WK-vfP" secondAttribute="trailing" id="PVt-1f-oef"/>
|
||||
<constraint firstItem="Ze8-2s-lED" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" id="SZK-UA-BiA"/>
|
||||
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="fw1-9C-P6U" secondAttribute="bottom" constant="20" id="Uw7-fz-We7"/>
|
||||
<constraint firstItem="sDC-ZC-b6I" firstAttribute="leading" secondItem="kuw-3r-nzl" secondAttribute="trailing" constant="8" id="W06-wv-gqs"/>
|
||||
<constraint firstItem="oQb-3T-gg6" firstAttribute="top" secondItem="8Ky-iT-gpT" secondAttribute="bottom" constant="8" id="b0I-kW-GRc"/>
|
||||
<constraint firstItem="QQ6-5o-gla" firstAttribute="centerY" secondItem="N12-GK-yLY" secondAttribute="centerY" id="bqu-uw-PqG"/>
|
||||
<constraint firstItem="eYp-5M-Rgk" firstAttribute="centerY" secondItem="dlx-hC-oDg" secondAttribute="centerY" id="cV6-GZ-8IP"/>
|
||||
@ -192,7 +243,6 @@
|
||||
<constraint firstItem="5Ns-3P-r13" firstAttribute="leading" secondItem="Iw4-VH-Zwm" secondAttribute="trailing" constant="8" id="ry7-bQ-bRa"/>
|
||||
<constraint firstItem="fw1-9C-P6U" firstAttribute="top" secondItem="5Ns-3P-r13" secondAttribute="bottom" constant="8" id="tsW-3r-293"/>
|
||||
<constraint firstItem="7yA-a6-Sq7" firstAttribute="centerY" secondItem="ioY-T2-PEM" secondAttribute="centerY" id="wE0-Cg-4Qf"/>
|
||||
<constraint firstItem="sDC-ZC-b6I" firstAttribute="centerY" secondItem="kuw-3r-nzl" secondAttribute="centerY" id="wTg-7H-KXF"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
@ -206,13 +256,15 @@
|
||||
<outlet property="controlMeshSwitch" destination="Ta2-7B-7Ck" id="hVP-58-sGA"/>
|
||||
<outlet property="endcapSegmentedControl" destination="jQK-WK-vfP" id="MIt-kE-Kwg"/>
|
||||
<outlet property="frameTimeLabel" destination="Ze8-2s-lED" id="vLj-Id-oiv"/>
|
||||
<outlet property="infinitelySharpSwitch" destination="xBi-mu-U3U" id="p7I-aQ-tkO"/>
|
||||
<outlet property="modelPickerView" destination="oQb-3T-gg6" id="YLl-SI-Azc"/>
|
||||
<outlet property="patchClipCullingSwitch" destination="fw1-9C-P6U" id="P2G-3F-eJh"/>
|
||||
<outlet property="refLvlLabel" destination="N12-GK-yLY" id="lXc-6r-pZY"/>
|
||||
<outlet property="refinementStepper" destination="QQ6-5o-gla" id="URK-fS-krY"/>
|
||||
<outlet property="screenspaceTessellationSwitch" destination="7yA-a6-Sq7" id="RpM-ER-4Oy"/>
|
||||
<outlet property="shadingModePickerView" destination="8Ky-iT-gpT" id="PAS-0I-Vju"/>
|
||||
<outlet property="singleCreaseSwitch" destination="sDC-ZC-b6I" id="Arw-OY-Z4A"/>
|
||||
<outlet property="singleCreaseSwitch" destination="OEV-Vc-RmB" id="gAl-01-Jrw"/>
|
||||
<outlet property="smoothCornerSwitch" destination="FZx-Rb-43j" id="Ayt-Td-s6s"/>
|
||||
<outlet property="tesLvLlabel" destination="dlx-hC-oDg" id="haB-Hi-A9B"/>
|
||||
<outlet property="tessellationStepper" destination="eYp-5M-Rgk" id="IFG-H5-rJS"/>
|
||||
<outlet property="wireframeSwitch" destination="8kP-4Y-wzA" id="y3a-yu-4cs"/>
|
||||
|
@ -20,7 +20,9 @@
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *backpatchCullingSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *backfaceCullingSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *patchClipCullingSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *smoothCornerSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *singleCreaseSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *infinitelySharpSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *controlMeshSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *screenspaceTessellationSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISegmentedControl *endcapSegmentedControl;
|
||||
|
@ -88,7 +88,9 @@
|
||||
}
|
||||
|
||||
-(void)_applyOptions {
|
||||
_osdRenderer.useSingleCrease = _singleCreaseSwitch.isOn;
|
||||
_osdRenderer.useSmoothCornerPatch = _smoothCornerSwitch.isOn;
|
||||
_osdRenderer.useSingleCreasePatch = _singleCreaseSwitch.isOn;
|
||||
_osdRenderer.useInfinitelySharpPatch = _infinitelySharpSwitch.isOn;
|
||||
_osdRenderer.usePatchBackfaceCulling = _backpatchCullingSwitch.isOn;
|
||||
_osdRenderer.usePrimitiveBackfaceCulling = _backfaceCullingSwitch.isOn;
|
||||
_osdRenderer.useScreenspaceTessellation = _screenspaceTessellationSwitch.isOn;
|
||||
@ -103,7 +105,7 @@
|
||||
_osdRenderer.kernelType = kMetal;
|
||||
_osdRenderer.refinementLevel = _refinementStepper.value;
|
||||
_osdRenderer.tessellationLevel = _tessellationStepper.value;
|
||||
_osdRenderer.endCapMode = (EndCap)(1 + _endcapSegmentedControl.selectedSegmentIndex);
|
||||
_osdRenderer.endCapMode = (EndCap)(_endcapSegmentedControl.selectedSegmentIndex);
|
||||
|
||||
_tesLvLlabel.text = [NSString stringWithFormat:@"Tes Lvl. %d", (int)_osdRenderer.tessellationLevel];
|
||||
[_tesLvLlabel sizeToFit];
|
||||
@ -197,8 +199,12 @@
|
||||
_osdRenderer.usePrimitiveBackfaceCulling = sender.isOn;
|
||||
} else if(sender == _patchClipCullingSwitch) {
|
||||
_osdRenderer.usePatchClipCulling = sender.isOn;
|
||||
} else if(sender == _smoothCornerSwitch) {
|
||||
_osdRenderer.useSmoothCornerPatch = sender.isOn;
|
||||
} else if(sender == _singleCreaseSwitch) {
|
||||
_osdRenderer.useSingleCrease = sender.isOn;
|
||||
_osdRenderer.useSingleCreasePatch = sender.isOn;
|
||||
} else if(sender == _infinitelySharpSwitch) {
|
||||
_osdRenderer.useInfinitelySharpPatch = sender.isOn;
|
||||
} else if(sender == _controlMeshSwitch) {
|
||||
_osdRenderer.displayControlMeshEdges = sender.isOn;
|
||||
_osdRenderer.displayControlMeshVertices = sender.isOn;
|
||||
@ -209,7 +215,7 @@
|
||||
}
|
||||
|
||||
- (IBAction)endcapChanged:(UISegmentedControl *)sender {
|
||||
_osdRenderer.endCapMode = (EndCap)(1 + sender.selectedSegmentIndex);
|
||||
_osdRenderer.endCapMode = (EndCap)(sender.selectedSegmentIndex);
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
|
||||
@ -231,9 +237,11 @@
|
||||
} else if(pickerView == _shadingModePickerView) {
|
||||
switch((ShadingMode)row) {
|
||||
case kShadingMaterial: return @"Material";
|
||||
case kShadingNormal: return @"Normal";
|
||||
case kShadingPatchCoord: return @"Patch Coord";
|
||||
case kShadingFaceVaryingColor: return @"FaceVarying Color";
|
||||
case kShadingPatchType: return @"Patch Type";
|
||||
case kShadingPatchDepth: return @"Patch Depth";
|
||||
case kShadingPatchCoord: return @"Patch Coord";
|
||||
case kShadingNormal: return @"Normal";
|
||||
}
|
||||
}
|
||||
return @"";
|
||||
|
@ -28,7 +28,7 @@
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
typedef enum {
|
||||
kEndCapNone = 0,
|
||||
kEndCapBilinearBasis = 0,
|
||||
kEndCapBSplineBasis,
|
||||
kEndCapLegacyGregory,
|
||||
kEndCapGregoryBasis,
|
||||
@ -41,7 +41,7 @@ typedef enum {
|
||||
kFVarLinearCornersPlus2,
|
||||
kFVarLinearBoundaries,
|
||||
kFVarLinearAll
|
||||
} FVarBoundary;
|
||||
} FVarLinearInterp;
|
||||
|
||||
typedef enum {
|
||||
kCPU = 0,
|
||||
@ -56,13 +56,13 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
kShadingMaterial = 0,
|
||||
kShadingFaceVaryingColor,
|
||||
kShadingPatchType,
|
||||
kShadingNormal,
|
||||
kShadingPatchDepth,
|
||||
kShadingPatchCoord,
|
||||
kShadingFaceVarying,
|
||||
kShadingNormal,
|
||||
} ShadingMode;
|
||||
|
||||
|
||||
typedef struct {
|
||||
float rotationX;
|
||||
float rotationY;
|
||||
@ -89,7 +89,7 @@ typedef struct {
|
||||
@property (readonly, nonatomic) id<OSDRendererDelegate> delegate;
|
||||
|
||||
@property (nonatomic) unsigned refinementLevel;
|
||||
@property (nonatomic) float tessellationLevel;
|
||||
@property (nonatomic) int tessellationLevel;
|
||||
|
||||
@property (readonly, nonatomic) NSArray<NSString*>* loadedModels;
|
||||
@property (nonatomic) NSString* currentModel;
|
||||
@ -103,7 +103,8 @@ typedef struct {
|
||||
@property (nonatomic) bool usePatchIndexBuffer;
|
||||
@property (nonatomic) bool usePatchBackfaceCulling;
|
||||
@property (nonatomic) bool usePatchClipCulling;
|
||||
@property (nonatomic) bool useSingleCrease;
|
||||
@property (nonatomic) bool useSmoothCornerPatch;
|
||||
@property (nonatomic) bool useSingleCreasePatch;
|
||||
@property (nonatomic) bool useInfinitelySharpPatch;
|
||||
@property (nonatomic) bool useStageIn;
|
||||
@property (nonatomic) bool usePrimitiveBackfaceCulling;
|
||||
@ -112,10 +113,11 @@ typedef struct {
|
||||
@property (nonatomic) bool animateVertices;
|
||||
@property (nonatomic) bool displayControlMeshEdges;
|
||||
@property (nonatomic) bool displayControlMeshVertices;
|
||||
@property (nonatomic) bool legacyGregoryEnabled;
|
||||
@property (nonatomic) DisplayStyle displayStyle;
|
||||
@property (nonatomic) ShadingMode shadingMode;
|
||||
@property (nonatomic) EndCap endCapMode;
|
||||
@property (nonatomic) FVarBoundary fVarBoundary;
|
||||
@property (nonatomic) FVarLinearInterp fVarLinearInterp;
|
||||
@property (nonatomic) KernelType kernelType;
|
||||
|
||||
@end
|
||||
|
@ -28,10 +28,11 @@
|
||||
using namespace metal;
|
||||
|
||||
#define SHADING_TYPE_MATERIAL 0
|
||||
#define SHADING_TYPE_PATCH 1
|
||||
#define SHADING_TYPE_NORMAL 2
|
||||
#define SHADING_TYPE_PATCH_COORD 3
|
||||
#define SHADING_TYPE_FACE_VARYING 4
|
||||
#define SHADING_TYPE_FACE_VARYING_COLOR 1
|
||||
#define SHADING_TYPE_PATCH_TYPE 2
|
||||
#define SHADING_TYPE_PATCH_DEPTH 3
|
||||
#define SHADING_TYPE_PATCH_COORD 4
|
||||
#define SHADING_TYPE_NORMAL 5
|
||||
|
||||
struct PerFrameConstants {
|
||||
float4x4 ModelViewMatrix;
|
||||
@ -45,8 +46,7 @@ struct OutputVertex {
|
||||
float4 positionOut [[position]];
|
||||
float3 position;
|
||||
float3 normal;
|
||||
|
||||
#if SHADING_TYPE == SHADING_TYPE_PATCH || SHADING_TYPE == SHADING_TYPE_PATCH_COORD || SHADING_TYPE_FACE_VARYING
|
||||
#if SHADING_TYPE == SHADING_TYPE_PATCH_TYPE || SHADING_TYPE == SHADING_TYPE_PATCH_DEPTH || SHADING_TYPE == SHADING_TYPE_PATCH_COORD || SHADING_TYPE_FACE_VARYING_COLOR
|
||||
float3 patchColor;
|
||||
#endif
|
||||
};
|
||||
@ -120,11 +120,11 @@ const constant float4 patchColors[] = {
|
||||
float4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
||||
|
||||
float4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
||||
float4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 0
|
||||
float4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 1
|
||||
float4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 2
|
||||
float4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 3
|
||||
float4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 4
|
||||
float4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 0
|
||||
float4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 1
|
||||
float4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 2
|
||||
float4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 3
|
||||
float4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 4
|
||||
|
||||
float4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||
float4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||
@ -164,7 +164,7 @@ getAdaptivePatchColor(int3 patchParam
|
||||
if (edgeCount == 1) {
|
||||
patchType = 2; // BOUNDARY
|
||||
}
|
||||
if (edgeCount == 2) {
|
||||
if (edgeCount > 1) {
|
||||
patchType = 3; // CORNER
|
||||
}
|
||||
|
||||
@ -186,6 +186,19 @@ getAdaptivePatchColor(int3 patchParam
|
||||
return patchColors[6*patchType + pattern];
|
||||
}
|
||||
|
||||
float4
|
||||
getAdaptiveDepthColor(int3 patchParam)
|
||||
{
|
||||
// Represent depth with repeating cycle of four colors:
|
||||
const float4 depthColors[4] = {
|
||||
float4(0.0f, 0.5f, 0.5f, 1.0f),
|
||||
float4(1.0f, 1.0f, 1.0f, 1.0f),
|
||||
float4(0.0f, 1.0f, 1.0f, 1.0f),
|
||||
float4(0.5f, 1.0f, 0.5f, 1.0f)
|
||||
};
|
||||
return depthColors[OsdGetPatchRefinementLevel(patchParam) & 3];
|
||||
}
|
||||
|
||||
#if OSD_IS_ADAPTIVE
|
||||
#if USE_STAGE_IN
|
||||
#if OSD_PATCH_REGULAR
|
||||
@ -390,7 +403,7 @@ kernel void compute_main(
|
||||
}
|
||||
}
|
||||
|
||||
#if SHADING_TYPE == SHADING_TYPE_FACE_VARYING
|
||||
#if SHADING_TYPE == SHADING_TYPE_FACE_VARYING_COLOR
|
||||
float3
|
||||
interpolateFaceVaryingColor(
|
||||
int patch_id,
|
||||
@ -467,16 +480,18 @@ vertex OutputVertex vertex_main(
|
||||
out.positionOut = frameConsts.ModelViewProjectionMatrix * float4(patchVertex.position, 1.0f);
|
||||
|
||||
out.normal = mul(frameConsts.ModelViewMatrix, patchVertex.normal);
|
||||
#if SHADING_TYPE == SHADING_TYPE_PATCH
|
||||
#if SHADING_TYPE == SHADING_TYPE_PATCH_TYPE
|
||||
#if OSD_PATCH_ENABLE_SINGLE_CREASE
|
||||
out.patchColor = getAdaptivePatchColor(patchParam, patchVertex.vSegments).xyz;
|
||||
#else
|
||||
out.patchColor = getAdaptivePatchColor(patchParam).xyz;
|
||||
#endif
|
||||
#elif SHADING_TYPE == SHADING_TYPE_PATCH_DEPTH
|
||||
out.patchColor = getAdaptiveDepthColor(patchParam).xyz;
|
||||
#elif SHADING_TYPE == SHADING_TYPE_NORMAL
|
||||
#elif SHADING_TYPE == SHADING_TYPE_PATCH_COORD
|
||||
out.patchColor = patchVertex.patchCoord.xyz;
|
||||
#elif SHADING_TYPE == SHADING_TYPE_FACE_VARYING
|
||||
#elif SHADING_TYPE == SHADING_TYPE_FACE_VARYING_COLOR
|
||||
out.patchColor = interpolateFaceVaryingColor(
|
||||
patch_id,
|
||||
patchVertex.tessCoord.xy,
|
||||
@ -667,7 +682,7 @@ vertex OutputVertex vertex_main(
|
||||
float3 p1 = vertexBuffer[indicesBuffer[primID * 3 + 1]].position;
|
||||
float3 p2 = vertexBuffer[indicesBuffer[primID * 3 + 2]].position;
|
||||
float3 position = vertexBuffer[indicesBuffer[vertex_id]].position;
|
||||
float2 uv = osdFacevaryingData[osdFaceVaryingIndices[vertex_id]].xy;
|
||||
float2 uv = osdFaceVaryingData[osdFaceVaryingIndices[vertex_id]].xy;
|
||||
#endif
|
||||
|
||||
float3 normal = normalize(cross(p2 - p1, p0 - p1));
|
||||
@ -678,9 +693,9 @@ vertex OutputVertex vertex_main(
|
||||
out.positionOut = frameConsts.ModelViewProjectionMatrix * float4(position, 1.0);
|
||||
out.normal = (frameConsts.ModelViewMatrix * float4(normal, 0.0)).xyz;
|
||||
|
||||
#if SHADING_TYPE == SHADING_TYPE_PATCH || SHADING_TYPE == SHADING_TYPE_PATCH_COORD
|
||||
#if SHADING_TYPE == SHADING_TYPE_PATCH_TYPE || SHADING_TYPE == SHADING_TYPE_PATCH_DEPTH || SHADING_TYPE == SHADING_TYPE_PATCH_COORD
|
||||
out.patchColor = out.normal;
|
||||
#elif SHADING_TYPE == SHADING_TYPE_FACE_VARYING
|
||||
#elif SHADING_TYPE == SHADING_TYPE_FACE_VARYING_COLOR
|
||||
out.patchColor.rg = uv;
|
||||
#endif
|
||||
|
||||
@ -728,12 +743,12 @@ fragment float4 fragment_main(OutputVertex in [[stage_in]],
|
||||
|
||||
#if SHADING_TYPE == SHADING_TYPE_MATERIAL
|
||||
const float3 diffuseColor = float3(0.4f, 0.4f, 0.8f);
|
||||
#elif SHADING_TYPE == SHADING_TYPE_PATCH
|
||||
#elif SHADING_TYPE == SHADING_TYPE_PATCH_TYPE || SHADING_TYPE == SHADING_TYPE_PATCH_DEPTH
|
||||
const float3 diffuseColor = in.patchColor;
|
||||
#endif
|
||||
#if SHADING_TYPE == SHADING_TYPE_NORMAL
|
||||
color.xyz = normalize(in.normal) * 0.5 + 0.5;
|
||||
#elif SHADING_TYPE == SHADING_TYPE_PATCH_COORD || SHADING_TYPE == SHADING_TYPE_FACE_VARYING
|
||||
#elif SHADING_TYPE == SHADING_TYPE_PATCH_COORD || SHADING_TYPE == SHADING_TYPE_FACE_VARYING_COLOR
|
||||
color.xyz = lighting(1.0, lightData, in.position, normalize(in.normal));
|
||||
int checker = int(floor(20*in.patchColor.r)+floor(20*in.patchColor.g))&1;
|
||||
color.xyz *= float3(in.patchColor.rg*checker, 1-checker);
|
||||
|
@ -30,10 +30,10 @@
|
||||
#import <fstream>
|
||||
#import <iostream>
|
||||
#import <iterator>
|
||||
#import <string>
|
||||
#import <sstream>
|
||||
#import <vector>
|
||||
#import <memory>
|
||||
#import <sstream>
|
||||
#import <string>
|
||||
#import <vector>
|
||||
|
||||
#import <opensubdiv/far/error.h>
|
||||
#import <opensubdiv/osd/mesh.h>
|
||||
@ -77,10 +77,9 @@
|
||||
|
||||
#define FVAR_SINGLE_BUFFER 1
|
||||
|
||||
using namespace OpenSubdiv::OPENSUBDIV_VERSION;
|
||||
using namespace OpenSubdiv;
|
||||
|
||||
template <> Far::StencilTable const * Osd::convertToCompatibleStencilTable<OpenSubdiv::Far::StencilTable, OpenSubdiv::Far::StencilTable, OpenSubdiv::Osd::MTLContext>(
|
||||
OpenSubdiv::Far::StencilTable const *table, OpenSubdiv::Osd::MTLContext* /*context*/) {
|
||||
template <> Far::StencilTable const * Osd::convertToCompatibleStencilTable<OpenSubdiv::Far::StencilTable, OpenSubdiv::Far::StencilTable, OpenSubdiv::Osd::MTLContext>(OpenSubdiv::Far::StencilTable const *table, OpenSubdiv::Osd::MTLContext* /*context*/) {
|
||||
// no need for conversion
|
||||
// XXX: We don't want to even copy.
|
||||
if (not table) return NULL;
|
||||
@ -123,7 +122,6 @@ static const char* shaderSource =
|
||||
#include "mtlViewer.gen.h"
|
||||
;
|
||||
|
||||
|
||||
using Osd::MTLRingBuffer;
|
||||
|
||||
#define FRAME_LAG 3
|
||||
@ -171,6 +169,7 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
std::unique_ptr<MTLMeshInterface> _mesh;
|
||||
std::unique_ptr<MTLControlMeshDisplay> _controlMesh;
|
||||
std::unique_ptr<Osd::MTLLegacyGregoryPatchTable> _legacyGregoryPatchTable;
|
||||
bool _legacyGregoryEnabled;
|
||||
std::unique_ptr<Shape> _shape;
|
||||
|
||||
bool _needsRebuild;
|
||||
@ -191,8 +190,10 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
|
||||
-(instancetype)initWithDelegate:(id<OSDRendererDelegate>)delegate {
|
||||
self = [super init];
|
||||
if(self) {
|
||||
self.useSingleCrease = true;
|
||||
if (self) {
|
||||
self.useSmoothCornerPatch = false;
|
||||
self.useSingleCreasePatch = true;
|
||||
self.useInfinitelySharpPatch = false;
|
||||
self.useStageIn = !TARGET_OS_EMBEDDED;
|
||||
self.endCapMode = kEndCapBSplineBasis;
|
||||
self.useScreenspaceTessellation = true;
|
||||
@ -200,11 +201,13 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
self.usePatchIndexBuffer = false;
|
||||
self.usePatchBackfaceCulling = false;
|
||||
self.usePrimitiveBackfaceCulling = false;
|
||||
self.useAdaptive = true;
|
||||
self.kernelType = kMetal;
|
||||
self.refinementLevel = 2;
|
||||
self.tessellationLevel = 8;
|
||||
self.tessellationLevel = 1;
|
||||
self.shadingMode = kShadingPatchType;
|
||||
self.displayStyle = kDisplayStyleWireOnShaded;
|
||||
self.legacyGregoryEnabled = true;
|
||||
|
||||
_frameCount = 0;
|
||||
_animationFrames = 0;
|
||||
@ -239,7 +242,6 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
|
||||
float r = sin(_animationFrames*0.01f) * _animateVertices;
|
||||
for (int i = 0; i < _numVertices; ++i) {
|
||||
float move = 0.05f*cosf(p[0]*20+_animationFrames*0.01f);
|
||||
float ct = cos(p[2] * r);
|
||||
float st = sin(p[2] * r);
|
||||
n[0] = p[0]*ct + p[1]*st;
|
||||
@ -458,7 +460,7 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
|
||||
if(_displayStyle == kDisplayStyleWireOnShaded)
|
||||
{
|
||||
simd::float4 shade = {1, 1,1,1};
|
||||
simd::float4 shade = {1,1,1,1};
|
||||
[renderCommandEncoder setFragmentBytes:&shade length:sizeof(shade) atIndex:2];
|
||||
[renderCommandEncoder setTriangleFillMode:MTLTriangleFillModeLines];
|
||||
[renderCommandEncoder setDepthBias:-5 slopeScale:-1.0 clamp:-100.0];
|
||||
@ -637,10 +639,6 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
|
||||
-(void)_rebuildModel {
|
||||
|
||||
using namespace OpenSubdiv;
|
||||
using namespace Sdc;
|
||||
using namespace Osd;
|
||||
using namespace Far;
|
||||
auto shapeDesc = &g_defaultShapes[[_loadedModels indexOfObject:_currentModel]];
|
||||
_shape.reset(Shape::parseObj(shapeDesc->data.c_str(), shapeDesc->scheme));
|
||||
const auto scheme = shapeDesc->scheme;
|
||||
@ -649,7 +647,7 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
Sdc::SchemeType sdctype = GetSdcType(*_shape);
|
||||
Sdc::Options sdcoptions = GetSdcOptions(*_shape);
|
||||
|
||||
sdcoptions.SetFVarLinearInterpolation((OpenSubdiv::Sdc::Options::FVarLinearInterpolation)_fVarBoundary);
|
||||
sdcoptions.SetFVarLinearInterpolation((OpenSubdiv::Sdc::Options::FVarLinearInterpolation)_fVarLinearInterp);
|
||||
|
||||
std::unique_ptr<OpenSubdiv::Far::TopologyRefiner> refiner;
|
||||
refiner.reset(Far::TopologyRefinerFactory<Shape>::Create(*_shape, Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions)));
|
||||
@ -661,16 +659,16 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
|
||||
// Adaptive refinement currently supported only for catmull-clark scheme
|
||||
_doAdaptive = (_useAdaptive && scheme == kCatmark);
|
||||
bool doSingleCreasePatch = (_useSingleCrease && scheme == kCatmark);
|
||||
bool doInfSharpPatch = (_useInfinitelySharpPatch && scheme == kCatmark);
|
||||
|
||||
Osd::MeshBitset bits;
|
||||
bits.set(Osd::MeshAdaptive, _doAdaptive);
|
||||
bits.set(Osd::MeshUseSingleCreasePatch, doSingleCreasePatch);
|
||||
bits.set(Osd::MeshUseInfSharpPatch, doInfSharpPatch);
|
||||
bits.set(Osd::MeshEndCapBSplineBasis, _endCapMode == kEndCapBSplineBasis);
|
||||
bits.set(Osd::MeshEndCapGregoryBasis, _endCapMode == kEndCapGregoryBasis);
|
||||
bits.set(Osd::MeshEndCapLegacyGregory, _endCapMode == kEndCapLegacyGregory);
|
||||
bits.set(Osd::MeshAdaptive, _doAdaptive);
|
||||
bits.set(Osd::MeshUseSmoothCornerPatch, _useSmoothCornerPatch);
|
||||
bits.set(Osd::MeshUseSingleCreasePatch, _useSingleCreasePatch);
|
||||
bits.set(Osd::MeshUseInfSharpPatch, _useInfinitelySharpPatch);
|
||||
bits.set(Osd::MeshEndCapBilinearBasis, _endCapMode == kEndCapBilinearBasis);
|
||||
bits.set(Osd::MeshEndCapBSplineBasis, _endCapMode == kEndCapBSplineBasis);
|
||||
bits.set(Osd::MeshEndCapGregoryBasis, _endCapMode == kEndCapGregoryBasis);
|
||||
bits.set(Osd::MeshEndCapLegacyGregory, _endCapMode == kEndCapLegacyGregory);
|
||||
|
||||
int level = _refinementLevel;
|
||||
_numVertexElements = 3;
|
||||
@ -678,8 +676,8 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
_numVaryingElements = 0;
|
||||
bits.set(OpenSubdiv::Osd::MeshInterleaveVarying, _numVaryingElements > 0);
|
||||
|
||||
_numFaceVaryingElements = (_shadingMode == kShadingFaceVarying && _shape->HasUV()) ? 2 : 0;
|
||||
if (_numFaceVaryingElements > 0) {
|
||||
_numFaceVaryingElements = (_shadingMode == kShadingFaceVaryingColor && _shape->HasUV()) ? 2 : 0;
|
||||
if (_numFaceVaryingElements > 0) {;
|
||||
bits.set(OpenSubdiv::Osd::MeshFVarData, _numFaceVaryingElements > 0);
|
||||
bits.set(OpenSubdiv::Osd::MeshFVarAdaptive, _doAdaptive);
|
||||
}
|
||||
@ -837,7 +835,7 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
[self _updateCamera];
|
||||
auto pData = _frameConstantsBuffer.data();
|
||||
|
||||
pData->TessLevel = _tessellationLevel;
|
||||
pData->TessLevel = static_cast<float>(1 << _tessellationLevel);
|
||||
|
||||
if(_doAdaptive)
|
||||
{
|
||||
@ -890,7 +888,7 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
_perPatchDataOffsets[0] = totalPatchDataSize;
|
||||
|
||||
float elementFloats = 3;
|
||||
if(_useSingleCrease)
|
||||
if(_useSingleCreasePatch)
|
||||
elementFloats += 6;
|
||||
|
||||
totalPatchDataSize += elementFloats * sizeof(float) * patch.GetNumPatches() * patch.desc.GetNumControlVertices(); // OsdPerPatchVertexBezier
|
||||
@ -1032,7 +1030,7 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
DEFINE(OSD_PATCH_INDEX_BUFFER_INDEX,OSD_PATCH_INDEX_BUFFER_INDEX);
|
||||
DEFINE(OSD_DRAWINDIRECT_BUFFER_INDEX,OSD_DRAWINDIRECT_BUFFER_INDEX);
|
||||
DEFINE(OSD_KERNELLIMIT_BUFFER_INDEX,OSD_KERNELLIMIT_BUFFER_INDEX);
|
||||
DEFINE(OSD_PATCH_ENABLE_SINGLE_CREASE, allowsSingleCrease && _useSingleCrease);
|
||||
DEFINE(OSD_PATCH_ENABLE_SINGLE_CREASE, allowsSingleCrease && _useSingleCreasePatch);
|
||||
auto partitionMode = _useFractionalTessellation ? MTLTessellationPartitionModeFractionalOdd : MTLTessellationPartitionModePow2;
|
||||
DEFINE(OSD_FRACTIONAL_EVEN_SPACING, partitionMode == MTLTessellationPartitionModeFractionalEven);
|
||||
DEFINE(OSD_FRACTIONAL_ODD_SPACING, partitionMode == MTLTessellationPartitionModeFractionalOdd);
|
||||
@ -1127,7 +1125,7 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
vertexDesc.attributes[0].format = MTLVertexFormatFloat3;
|
||||
vertexDesc.attributes[0].offset = 0;
|
||||
|
||||
if(_useSingleCrease)
|
||||
if(_useSingleCreasePatch)
|
||||
{
|
||||
vertexDesc.layouts[OSD_PERPATCHVERTEXBEZIER_BUFFER_INDEX].stride += sizeof(float) * 3 * 2;
|
||||
|
||||
@ -1289,8 +1287,8 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
translate(pData->ModelViewMatrix, 0, 0, -_cameraData.dollyDistance);
|
||||
rotate(pData->ModelViewMatrix, _cameraData.rotationY, 1, 0, 0);
|
||||
rotate(pData->ModelViewMatrix, _cameraData.rotationX, 0, 1, 0);
|
||||
translate(pData->ModelViewMatrix, -_meshCenter[0], -_meshCenter[2], _meshCenter[1]); // z-up model
|
||||
rotate(pData->ModelViewMatrix, -90, 1, 0, 0); // z-up model
|
||||
translate(pData->ModelViewMatrix, -_meshCenter[0], -_meshCenter[1], -_meshCenter[2]);
|
||||
inverseMatrix(pData->ModelViewInverseMatrix, pData->ModelViewMatrix);
|
||||
|
||||
identity(pData->ProjectionMatrix);
|
||||
@ -1299,16 +1297,14 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)_initializeBuffers {
|
||||
_frameConstantsBuffer.alloc(_context.device, 1, @"frame constants");
|
||||
_tessFactorsBuffer.alloc(_context.device, 1, @"tessellation factors", MTLResourceStorageModePrivate);
|
||||
_lightsBuffer.alloc(_context.device, 2, @"lights");
|
||||
}
|
||||
|
||||
-(void)_initializeCamera {
|
||||
_cameraData.dollyDistance = 4;
|
||||
_cameraData.rotationY = 30;
|
||||
_cameraData.rotationY = 0;
|
||||
_cameraData.rotationX = 0;
|
||||
_cameraData.aspectRatio = 1;
|
||||
}
|
||||
@ -1366,9 +1362,9 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
}
|
||||
|
||||
|
||||
-(void)setFVarBoundary:(FVarBoundary)fVarBoundary {
|
||||
_needsRebuild |= (fVarBoundary != _fVarBoundary);
|
||||
_fVarBoundary = fVarBoundary;
|
||||
-(void)setFVarLinearInterp:(FVarLinearInterp)fVarLinearInterp {
|
||||
_needsRebuild |= (fVarLinearInterp != _fVarLinearInterp);
|
||||
_fVarLinearInterp = fVarLinearInterp;
|
||||
}
|
||||
|
||||
-(void)setCurrentModel:(NSString *)currentModel {
|
||||
@ -1381,9 +1377,14 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
|
||||
_refinementLevel = refinementLevel;
|
||||
}
|
||||
|
||||
-(void)setUseSingleCrease:(bool)useSingleCrease {
|
||||
_needsRebuild |= useSingleCrease != _useSingleCrease;
|
||||
_useSingleCrease = useSingleCrease;
|
||||
-(void)setUseSmoothCornerPatch:(bool)useSmoothCornerPatch {
|
||||
_needsRebuild |= useSmoothCornerPatch != _useSmoothCornerPatch;
|
||||
_useSmoothCornerPatch = useSmoothCornerPatch;
|
||||
}
|
||||
|
||||
-(void)setUseSingleCreasePatch:(bool)useSingleCreasePatch {
|
||||
_needsRebuild |= useSingleCreasePatch != _useSingleCreasePatch;
|
||||
_useSingleCreasePatch = useSingleCreasePatch;
|
||||
}
|
||||
|
||||
-(void)setUsePatchClipCulling:(bool)usePatchClipCulling {
|
||||
|
Loading…
Reference in New Issue
Block a user