Add Chromium-only Blender WebEngine parity work
This commit is contained in:
94
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/CMakeLists.txt
vendored
Normal file
94
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
#
|
||||
# Copyright 2013 Pixar
|
||||
#
|
||||
# Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
# https://opensubdiv.org/license.
|
||||
#
|
||||
|
||||
# *** mtlViewer ***
|
||||
|
||||
if(IOS)
|
||||
set(BUNDLE_FILES
|
||||
"iOS/Base.lproj/LaunchScreen.storyboard"
|
||||
"iOS/Base.lproj/Main.storyboard"
|
||||
)
|
||||
set(PLATFORM_PLIST "iOS/Info.plist")
|
||||
set(PLATFORM_FILES
|
||||
"iOS/AppDelegate.h"
|
||||
"iOS/AppDelegate.m"
|
||||
"iOS/main.m"
|
||||
"iOS/ViewController.h"
|
||||
"iOS/ViewController.mm"
|
||||
)
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
"-framework UIKit"
|
||||
)
|
||||
set_source_files_properties("${BUNDLE_FILES}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
else()
|
||||
set(BUNDLE_FILES
|
||||
"OSX/MainMenu.xib"
|
||||
)
|
||||
set(PLATFORM_PLIST "OSX/Info.plist")
|
||||
set(PLATFORM_FILES
|
||||
"OSX/AppDelegate.h"
|
||||
"OSX/AppDelegate.m"
|
||||
"OSX/main.m"
|
||||
"OSX/ViewController.h"
|
||||
"OSX/ViewController.mm"
|
||||
)
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
"-framework OpenGL"
|
||||
"-framework AppKit"
|
||||
)
|
||||
set_source_files_properties("${BUNDLE_FILES}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
"${OPENSUBDIV_INCLUDE_DIR}"
|
||||
"${METAL_INCLUDE_DIR}"
|
||||
)
|
||||
|
||||
list(APPEND PLATFORM_FILES
|
||||
"mtlViewer.h"
|
||||
"mtlViewer.mm"
|
||||
)
|
||||
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
"osd_static_framework"
|
||||
"${METAL_LIBRARY}"
|
||||
"-framework MetalKit"
|
||||
"-framework Foundation"
|
||||
"-framework QuartzCore"
|
||||
)
|
||||
|
||||
osd_stringify("mtlViewer.metal" INC_FILES)
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
osd_add_executable(mtlViewer "examples/mtlViewer"
|
||||
MACOSX_BUNDLE
|
||||
"${PLATFORM_FILES}"
|
||||
"${INC_FILES}"
|
||||
"${BUNDLE_FILES}"
|
||||
$<TARGET_OBJECTS:regression_common_obj>
|
||||
$<TARGET_OBJECTS:regression_far_utils_obj>
|
||||
$<TARGET_OBJECTS:examples_common_mtl_obj>
|
||||
)
|
||||
|
||||
|
||||
set_target_properties (mtlViewer PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
RESOURCE "${BUNDLE_FILES}"
|
||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/${PLATFORM_PLIST}"
|
||||
)
|
||||
|
||||
if(IOS)
|
||||
set_target_properties(mtlViewer PROPERTIES
|
||||
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(mtlViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS mtlViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
15
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/AppDelegate.h
vendored
Normal file
15
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/AppDelegate.h
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Copyright 2015 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||
|
||||
|
||||
@end
|
||||
|
||||
27
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/AppDelegate.m
vendored
Normal file
27
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/AppDelegate.m
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright 2015 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import <MetalKit/MetalKit.h>
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
|
||||
return true;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
@end
|
||||
58
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/AppIcon.appiconset/Contents.json
vendored
Normal file
58
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/AppIcon.appiconset/Contents.json
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
34
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/Info.plist
vendored
Normal file
34
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/Info.plist
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Pixar. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
</dict>
|
||||
</plist>
|
||||
686
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/MainMenu.xib
vendored
Normal file
686
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/MainMenu.xib
vendored
Normal file
@@ -0,0 +1,686 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16C20" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="aZQ-9t-9YL" id="ke3-sq-jK1"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="aZQ-9t-9YL" customClass="AppDelegate"/>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="Test" id="1Xt-HY-uBw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Test" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About mtlViewer" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
|
||||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
|
||||
<menuItem title="Services" id="NMo-om-nkz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||
<menuItem title="Hide mtlViewer" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||
<menuItem title="Quit mtlViewer" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="File" id="dMs-cI-mzQ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="File" id="bib-Uj-vzu">
|
||||
<items>
|
||||
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
|
||||
<connections>
|
||||
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
|
||||
<connections>
|
||||
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open Recent" id="tXI-mr-wws">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
|
||||
<items>
|
||||
<menuItem title="Clear Menu" id="vNY-rz-j42">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
|
||||
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
|
||||
<connections>
|
||||
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
|
||||
<connections>
|
||||
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
|
||||
<connections>
|
||||
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Revert to Saved" id="KaW-ft-85H">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
|
||||
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
|
||||
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
|
||||
<connections>
|
||||
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Edit" id="5QF-Oa-p0T">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
|
||||
<connections>
|
||||
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
|
||||
<connections>
|
||||
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
|
||||
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
|
||||
<connections>
|
||||
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
|
||||
<connections>
|
||||
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
|
||||
<connections>
|
||||
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="pa3-QI-u2k">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
|
||||
<menuItem title="Find" id="4EN-yA-p0u">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
||||
<items>
|
||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
|
||||
<connections>
|
||||
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
|
||||
<items>
|
||||
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
|
||||
<connections>
|
||||
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
|
||||
<connections>
|
||||
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
|
||||
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Substitutions" id="9ic-FL-obx">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
|
||||
<items>
|
||||
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
|
||||
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Links" id="cwL-P1-jid">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Data Detectors" id="tRr-pd-1PS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Transformations" id="2oI-Rn-ZJC">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
|
||||
<items>
|
||||
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Speech" id="xrE-MZ-jX0">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
|
||||
<items>
|
||||
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Format" id="jxT-CU-nIS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
|
||||
<items>
|
||||
<menuItem title="Font" id="Gi5-1S-RQB">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
|
||||
<items>
|
||||
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
|
||||
<connections>
|
||||
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
|
||||
<connections>
|
||||
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
|
||||
<menuItem title="Kern" id="jBQ-r6-VK2">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="GUa-eO-cwY">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="cDB-IK-hbR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Tighten" id="46P-cB-AYj">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Loosen" id="ogc-rX-tC1">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Ligatures" id="o6e-r0-MWq">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="agt-UL-0e3">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="J7y-lM-qPV">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use All" id="xQD-1f-W4t">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Baseline" id="OaQ-X3-Vso">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="3Om-Ey-2VK">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Superscript" id="Rqc-34-cIF">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Subscript" id="I0S-gh-46l">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Raise" id="2h7-ER-AoG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Lower" id="1tx-W0-xDw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
|
||||
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
|
||||
<connections>
|
||||
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
|
||||
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Text" id="Fal-I4-PZk">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Text" id="d9c-me-L2H">
|
||||
<items>
|
||||
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
|
||||
<connections>
|
||||
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
|
||||
<connections>
|
||||
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Justify" id="J5U-5w-g23">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
|
||||
<connections>
|
||||
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
|
||||
<menuItem title="Writing Direction" id="H1b-Si-o9J">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
|
||||
<items>
|
||||
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="YGs-j5-SAR">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="Lbh-J2-qVU">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="jFq-tB-4Kx">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
|
||||
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="Nop-cj-93Q">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="BgM-ve-c93">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="RB4-Sm-HuC">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
|
||||
<menuItem title="Show Ruler" id="vLm-3I-IUL">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="mtlViewer Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hasShadow="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="1920" height="1080"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
|
||||
<view key="contentView" id="se5-gp-TjO" customClass="OSDView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<connections>
|
||||
<outlet property="menu" destination="AYu-sK-qS6" id="0eg-gK-PK4"/>
|
||||
</connections>
|
||||
</view>
|
||||
<point key="canvasLocation" x="172" y="11"/>
|
||||
</window>
|
||||
<viewController id="tdF-Vh-f4K" customClass="ViewController">
|
||||
<connections>
|
||||
<outlet property="view" destination="se5-gp-TjO" id="fc1-e3-wEk"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
</objects>
|
||||
</document>
|
||||
27
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/ViewController.h
vendored
Normal file
27
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/ViewController.h
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright 2015 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import "../mtlViewer.h"
|
||||
#import "../../common/mtlHud.h"
|
||||
@class ViewController;
|
||||
|
||||
@interface OSDView : MTKView {
|
||||
@public
|
||||
MTLhud hud;
|
||||
}
|
||||
@property (nonatomic) ViewController* controller;
|
||||
@end
|
||||
|
||||
@interface ViewController : NSViewController<MTKViewDelegate, OSDRendererDelegate>
|
||||
@property (weak) IBOutlet OSDView *view;
|
||||
@property (nonatomic) OSDRenderer* osdRenderer;
|
||||
|
||||
|
||||
@end
|
||||
494
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/ViewController.mm
vendored
Normal file
494
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/ViewController.mm
vendored
Normal file
@@ -0,0 +1,494 @@
|
||||
//
|
||||
// Copyright 2015 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
|
||||
#import "ViewController.h"
|
||||
#import <opensubdiv/far/patchDescriptor.h>
|
||||
|
||||
using namespace OpenSubdiv::OPENSUBDIV_VERSION;
|
||||
|
||||
enum {
|
||||
kHUD_CB_DISPLAY_CONTROL_MESH_EDGES,
|
||||
kHUD_CB_DISPLAY_CONTROL_MESH_VERTS,
|
||||
kHUD_CB_ANIMATE_VERTICES,
|
||||
kHUD_CB_DISPLAY_PATCH_COLOR, //Unused
|
||||
kHUD_CB_DISPLAY_PATCH_CVs, //Unused
|
||||
kHUD_CB_VIEW_LOD,
|
||||
kHUD_CB_FRACTIONAL_SPACING,
|
||||
kHUD_CB_PATCH_CULL,
|
||||
kHUD_CB_BACK_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,
|
||||
kHUD_CB_DISPLAY_PATCH_COUNTS
|
||||
};
|
||||
|
||||
@implementation OSDView {
|
||||
bool _mouseDown;
|
||||
NSPoint _lastMouse;
|
||||
}
|
||||
|
||||
-(void)mouseDown:(NSEvent *)event {
|
||||
if(event.buttonNumber == 0) {
|
||||
_lastMouse = [event locationInWindow];
|
||||
_mouseDown = !hud.MouseClick(_lastMouse.x, (self.bounds.size.height - _lastMouse.y));
|
||||
}
|
||||
[super mouseDown:event];
|
||||
}
|
||||
|
||||
-(void)mouseUp:(NSEvent *)event {
|
||||
if(event.buttonNumber == 0) {
|
||||
_mouseDown = false;
|
||||
_lastMouse = [event locationInWindow];
|
||||
hud.MouseRelease();
|
||||
}
|
||||
[super mouseUp:event];
|
||||
}
|
||||
|
||||
-(void)mouseDragged:(NSEvent *)event {
|
||||
auto mouse = [NSEvent mouseLocation];
|
||||
hud.MouseMotion(mouse.x, mouse.y);
|
||||
|
||||
if(_mouseDown) {
|
||||
CGPoint delta;
|
||||
delta.x = mouse.x - _lastMouse.x;
|
||||
delta.y = mouse.y - _lastMouse.y;
|
||||
_lastMouse = mouse;
|
||||
|
||||
_controller.osdRenderer.camera->rotationX += delta.x / 2.0;
|
||||
_controller.osdRenderer.camera->rotationY -= delta.y / 2.0;
|
||||
}
|
||||
[super mouseDragged:event];
|
||||
}
|
||||
|
||||
-(void)keyDown:(NSEvent *)event {
|
||||
const auto key = [event.charactersIgnoringModifiers characterAtIndex:0];
|
||||
if (hud.KeyDown(key)) {
|
||||
return;
|
||||
} else if(key == '=') {
|
||||
_controller.osdRenderer.tessellationLevel = std::min(_controller.osdRenderer.tessellationLevel + 1, 16);
|
||||
} else if (key == '-') {
|
||||
_controller.osdRenderer.tessellationLevel = std::max(_controller.osdRenderer.tessellationLevel - 1, 0);
|
||||
} else if (key == 'f') {
|
||||
[_controller.osdRenderer fitFrame];
|
||||
} else {
|
||||
[super keyDown:event];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)scrollWheel:(NSEvent *)event {
|
||||
_controller.osdRenderer.camera->dollyDistance += event.deltaY / 100.0;
|
||||
}
|
||||
|
||||
-(BOOL)acceptsFirstResponder {
|
||||
return true;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#define FRAME_HISTORY 30
|
||||
@implementation ViewController {
|
||||
id<MTLDevice> _device;
|
||||
id<MTLCommandQueue> _commandQueue;
|
||||
dispatch_semaphore_t _frameSemaphore;
|
||||
OSDRenderer* _osdRenderer;
|
||||
|
||||
unsigned _currentFrame;
|
||||
double _frameBeginTimestamp[FRAME_HISTORY];
|
||||
|
||||
NSMagnificationGestureRecognizer* _magnificationGesture;
|
||||
|
||||
int _showPatchCounts;
|
||||
}
|
||||
|
||||
-(void)viewDidLoad {
|
||||
|
||||
_device = MTLCreateSystemDefaultDevice();
|
||||
_commandQueue = [_device newCommandQueue];
|
||||
|
||||
_osdRenderer = [[OSDRenderer alloc] initWithDelegate:self];
|
||||
_osdRenderer.displayControlMeshEdges = false;
|
||||
|
||||
_frameSemaphore = dispatch_semaphore_create(3);
|
||||
|
||||
self.view.device = _device;
|
||||
self.view.delegate = self;
|
||||
self.view.depthStencilPixelFormat = MTLPixelFormatDepth32Float;
|
||||
self.view.clearColor = MTLClearColorMake(0.4245, 0.4167, 0.4245, 1);
|
||||
self.view.controller = self;
|
||||
self.view.sampleCount = 1;
|
||||
|
||||
self.view->hud.UIScale = 1.0;
|
||||
_osdRenderer.camera->aspectRatio = self.view.bounds.size.width / self.view.bounds.size.height;
|
||||
|
||||
_currentFrame = 0;
|
||||
|
||||
auto renderPipelineDescriptor = [MTLRenderPipelineDescriptor new];
|
||||
renderPipelineDescriptor.colorAttachments[0].pixelFormat = self.view.colorPixelFormat;
|
||||
renderPipelineDescriptor.depthAttachmentPixelFormat = self.view.depthStencilPixelFormat;
|
||||
renderPipelineDescriptor.sampleCount = self.view.sampleCount;
|
||||
|
||||
auto depthStencilDescriptor = [MTLDepthStencilDescriptor new];
|
||||
depthStencilDescriptor.depthWriteEnabled = false;
|
||||
depthStencilDescriptor.depthCompareFunction = MTLCompareFunctionAlways;
|
||||
|
||||
auto& hud = self.view->hud;
|
||||
|
||||
hud.Init(_device, renderPipelineDescriptor, depthStencilDescriptor, self.view.bounds.size.width, self.view.bounds.size.height, self.view.drawableSize.width, self.view.drawableSize.height);
|
||||
|
||||
auto callbackCheckbox = [=](bool value, int ID) {
|
||||
switch(ID) {
|
||||
case kHUD_CB_FREEZE:
|
||||
self.osdRenderer.freeze = value;
|
||||
break;
|
||||
case kHUD_CB_VIEW_LOD:
|
||||
self.osdRenderer.useScreenspaceTessellation = value;
|
||||
break;
|
||||
case kHUD_CB_PATCH_CULL:
|
||||
self.osdRenderer.usePatchClipCulling = value;
|
||||
|
||||
break;
|
||||
case kHUD_CB_ANIMATE_VERTICES:
|
||||
self.osdRenderer.animateVertices = value;
|
||||
break;
|
||||
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.useSingleCreasePatch = value;
|
||||
break;
|
||||
case kHUD_CB_DISPLAY_CONTROL_MESH_EDGES:
|
||||
self.osdRenderer.displayControlMeshEdges = value;
|
||||
break;
|
||||
case kHUD_CB_DISPLAY_CONTROL_MESH_VERTS:
|
||||
self.osdRenderer.displayControlMeshVertices = value;
|
||||
break;
|
||||
case kHUD_CB_BACK_CULL:
|
||||
self.osdRenderer.usePatchBackfaceCulling = value;
|
||||
self.osdRenderer.usePrimitiveBackfaceCulling = value;
|
||||
break;
|
||||
case kHUD_CB_PATCH_INDEX_BUFFER:
|
||||
self.osdRenderer.usePatchIndexBuffer = value;
|
||||
break;
|
||||
case kHUD_CB_ADAPTIVE:
|
||||
self.osdRenderer.useAdaptive = value;
|
||||
break;
|
||||
case kHUD_CB_INFINITE_SHARP_PATCH:
|
||||
self.osdRenderer.useInfinitelySharpPatch = value;
|
||||
break;
|
||||
case kHUD_CB_DISPLAY_PATCH_COUNTS:
|
||||
_showPatchCounts = value;
|
||||
break;
|
||||
default:
|
||||
assert("Unknown checkbox ID" && 0);
|
||||
}
|
||||
};
|
||||
|
||||
auto callbackKernel = [=](int kernelType) {
|
||||
switch((KernelType)kernelType) {
|
||||
case kCPU:
|
||||
case kMetal:
|
||||
self.osdRenderer.kernelType = (KernelType)(kernelType);
|
||||
break;
|
||||
default:
|
||||
assert("Unknown kernelType" && 0);
|
||||
}
|
||||
};
|
||||
|
||||
auto callbackFVarLinearInterp = [=](int fVarLinearInterp) {
|
||||
switch((FVarLinearInterp)fVarLinearInterp) {
|
||||
case kFVarLinearNone:
|
||||
case kFVarLinearCornersOnly:
|
||||
case kFVarLinearCornersPlus1:
|
||||
case kFVarLinearCornersPlus2:
|
||||
case kFVarLinearBoundaries:
|
||||
case kFVarLinearAll:
|
||||
self.osdRenderer.fVarLinearInterp = (FVarLinearInterp)fVarLinearInterp;
|
||||
}
|
||||
};
|
||||
|
||||
auto callbackDisplayStyle = [=](int displayStyle) {
|
||||
switch((DisplayStyle)displayStyle) {
|
||||
case kDisplayStyleWire:
|
||||
case kDisplayStyleShaded:
|
||||
case kDisplayStyleWireOnShaded:
|
||||
self.osdRenderer.displayStyle = (DisplayStyle)displayStyle;
|
||||
break;
|
||||
default:
|
||||
assert("Unknown displayStyle" && 0);
|
||||
}
|
||||
};
|
||||
|
||||
auto callbackShadingMode = [=](int shadingMode) {
|
||||
switch((ShadingMode)shadingMode) {
|
||||
case kShadingMaterial:
|
||||
case kShadingFaceVaryingColor:
|
||||
case kShadingPatchType:
|
||||
case kShadingPatchDepth:
|
||||
case kShadingPatchCoord:
|
||||
case kShadingNormal:
|
||||
self.osdRenderer.shadingMode = (ShadingMode)shadingMode;
|
||||
break;
|
||||
default:
|
||||
assert("Unknown shadingMode" && 0);
|
||||
}
|
||||
};
|
||||
|
||||
auto callbackEndCap = [=](int endCap) {
|
||||
switch((EndCap)endCap) {
|
||||
case kEndCapBilinearBasis:
|
||||
case kEndCapBSplineBasis:
|
||||
case kEndCapGregoryBasis:
|
||||
case kEndCapLegacyGregory:
|
||||
self.osdRenderer.endCapMode = (EndCap)endCap;
|
||||
break;
|
||||
default:
|
||||
assert("Unknown endCap" && 0);
|
||||
}
|
||||
};
|
||||
|
||||
auto callbackLevel = [=](int level) {
|
||||
self.osdRenderer.refinementLevel = level;
|
||||
};
|
||||
|
||||
auto callbackModel = [=](int modelIndex) {
|
||||
assert(modelIndex >= 0);
|
||||
assert((NSUInteger)modelIndex < self.osdRenderer.loadedModels.count);
|
||||
|
||||
self.osdRenderer.currentModel = self.osdRenderer.loadedModels[modelIndex];
|
||||
};
|
||||
|
||||
int y = 10;
|
||||
hud.AddCheckBox("Control edges (H)",
|
||||
_osdRenderer.displayControlMeshEdges,
|
||||
10, y, callbackCheckbox,
|
||||
kHUD_CB_DISPLAY_CONTROL_MESH_EDGES, 'h');
|
||||
y += 20;
|
||||
hud.AddCheckBox("Control vertices (J)",
|
||||
_osdRenderer.displayControlMeshVertices,
|
||||
10, y, callbackCheckbox,
|
||||
kHUD_CB_DISPLAY_CONTROL_MESH_VERTS, 'j');
|
||||
y += 20;
|
||||
hud.AddCheckBox("Animate vertices (M)", _osdRenderer.animateVertices,
|
||||
10, y, callbackCheckbox, kHUD_CB_ANIMATE_VERTICES, 'm');
|
||||
y += 20;
|
||||
hud.AddCheckBox("Screen space LOD (V)", _osdRenderer.useScreenspaceTessellation,
|
||||
10, y, callbackCheckbox, kHUD_CB_VIEW_LOD, 'v');
|
||||
y += 20;
|
||||
hud.AddCheckBox("Fractional spacing (T)", _osdRenderer.useFractionalTessellation,
|
||||
10, y, callbackCheckbox, kHUD_CB_FRACTIONAL_SPACING, 't');
|
||||
y += 20;
|
||||
hud.AddCheckBox("Frustum Patch Culling (P)", _osdRenderer.usePatchClipCulling,
|
||||
10, y, callbackCheckbox, kHUD_CB_PATCH_CULL, 'p');
|
||||
y += 20;
|
||||
hud.AddCheckBox("Backface Culling (B)", _osdRenderer.usePatchBackfaceCulling,
|
||||
10, y, callbackCheckbox, kHUD_CB_BACK_CULL, 'b');
|
||||
|
||||
y += 20;
|
||||
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,
|
||||
10, y, callbackCheckbox, kHUD_CB_FREEZE, ' ');
|
||||
y += 20;
|
||||
|
||||
int displaystyle_pulldown = hud.AddPullDown("DisplayStyle (W)", 200, 10, 250,
|
||||
callbackDisplayStyle, 'w');
|
||||
hud.AddPullDownButton(displaystyle_pulldown, "Wire", kDisplayStyleWire,
|
||||
_osdRenderer.displayStyle == kDisplayStyleWire);
|
||||
hud.AddPullDownButton(displaystyle_pulldown, "Shaded", kDisplayStyleShaded,
|
||||
_osdRenderer.displayStyle == kDisplayStyleShaded);
|
||||
hud.AddPullDownButton(displaystyle_pulldown, "Wire+Shaded", kDisplayStyleWireOnShaded,
|
||||
_osdRenderer.displayStyle == kDisplayStyleWireOnShaded);
|
||||
|
||||
int shading_pulldown = hud.AddPullDown("Shading (C)", 200, 70, 250,
|
||||
callbackShadingMode, 'c');
|
||||
|
||||
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);
|
||||
|
||||
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 fVarLinearInterp_pulldown = hud.AddPullDown("FVar Linear Interpolation (L)",
|
||||
650, 10, 300, callbackFVarLinearInterp, 'l');
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "None (edge only)",
|
||||
kFVarLinearNone,
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearNone);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Corners Only",
|
||||
kFVarLinearCornersOnly,
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearCornersOnly);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Corners 1 (edge corner)",
|
||||
kFVarLinearCornersPlus1,
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearCornersPlus1);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Corners 2 (edge corner prop)",
|
||||
kFVarLinearCornersPlus2,
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearCornersPlus2);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "Boundaries (always sharp)",
|
||||
kFVarLinearBoundaries,
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearBoundaries);
|
||||
hud.AddPullDownButton(fVarLinearInterp_pulldown, "All (bilinear)",
|
||||
kFVarLinearAll,
|
||||
_osdRenderer.fVarLinearInterp == kFVarLinearAll);
|
||||
|
||||
{
|
||||
hud.AddCheckBox("Adaptive (`)", _osdRenderer.useAdaptive,
|
||||
10, 190, callbackCheckbox, kHUD_CB_ADAPTIVE, '`');
|
||||
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, 250, callbackCheckbox, kHUD_CB_INFINITE_SHARP_PATCH, 'i');
|
||||
|
||||
int endcap_pulldown = hud.AddPullDown(
|
||||
"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, "Gregory",
|
||||
kEndCapGregoryBasis,
|
||||
_osdRenderer.endCapMode == kEndCapGregoryBasis);
|
||||
if (_osdRenderer.legacyGregoryEnabled) {
|
||||
hud.AddPullDownButton(endcap_pulldown, "LegacyGregory",
|
||||
kEndCapLegacyGregory,
|
||||
_osdRenderer.endCapMode == kEndCapLegacyGregory);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < 11; ++i) {
|
||||
NSString *level = [NSString stringWithFormat:@"Lv. %d", i];
|
||||
hud.AddRadioButton(3, [level UTF8String],
|
||||
i==(int)_osdRenderer.refinementLevel,
|
||||
10, 310+i*20, callbackLevel, i, '0'+(i%10));
|
||||
}
|
||||
|
||||
int shapes_pulldown = hud.AddPullDown("Shape (N)", -300, 10, 300, callbackModel, 'n');
|
||||
for (int i = 0; i < (int)_osdRenderer.loadedModels.count; ++i) {
|
||||
hud.AddPullDownButton(shapes_pulldown, _osdRenderer.loadedModels[i].UTF8String,i);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
-(void)drawInMTKView:(MTKView *)view {
|
||||
dispatch_semaphore_wait(_frameSemaphore, DISPATCH_TIME_FOREVER);
|
||||
|
||||
auto commandBuffer = [_commandQueue commandBuffer];
|
||||
|
||||
double avg = 0;
|
||||
for(int i = 0; i < FRAME_HISTORY; i++)
|
||||
avg += _frameBeginTimestamp[i];
|
||||
avg /= FRAME_HISTORY;
|
||||
|
||||
auto renderEncoder = [_osdRenderer drawFrame:commandBuffer];
|
||||
auto& hud = self.view->hud;
|
||||
if(hud.IsVisible()) {
|
||||
if(_showPatchCounts) {
|
||||
int x = -420;
|
||||
int y = -180;
|
||||
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, "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 : %d", _osdRenderer.tessellationLevel);
|
||||
hud.DrawString(10, -20, "FPS = %3.1f", 1.0 / avg);
|
||||
|
||||
|
||||
//Disable Culling & Force Fill mode when drawing the UI
|
||||
[renderEncoder setTriangleFillMode:MTLTriangleFillModeFill];
|
||||
[renderEncoder setCullMode:MTLCullModeNone];
|
||||
self.view->hud.Flush(renderEncoder);
|
||||
}
|
||||
[renderEncoder endEncoding];
|
||||
|
||||
__weak auto blockSemaphore = _frameSemaphore;
|
||||
unsigned frameId = _currentFrame % FRAME_HISTORY;
|
||||
auto frameBeginTime = CACurrentMediaTime();
|
||||
[commandBuffer addCompletedHandler:^(id<MTLCommandBuffer> _Nonnull) {
|
||||
dispatch_semaphore_signal(blockSemaphore);
|
||||
_frameBeginTimestamp[frameId] = CACurrentMediaTime() - frameBeginTime;
|
||||
}];
|
||||
|
||||
[commandBuffer presentDrawable:view.currentDrawable];
|
||||
[commandBuffer commit];
|
||||
|
||||
_currentFrame++;
|
||||
}
|
||||
|
||||
-(void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size {
|
||||
_osdRenderer.camera->aspectRatio = size.width / size.height;
|
||||
self.view->hud.Rebuild(self.view.bounds.size.width, self.view.bounds.size.height, size.width, size.height);
|
||||
}
|
||||
|
||||
-(void)setupDepthStencilState:(MTLDepthStencilDescriptor *)descriptor for:(OSDRenderer *)renderer {
|
||||
|
||||
}
|
||||
|
||||
-(void)setupRenderPipelineState:(MTLRenderPipelineDescriptor *)descriptor for:(OSDRenderer *)renderer {
|
||||
descriptor.depthAttachmentPixelFormat = self.view.depthStencilPixelFormat;
|
||||
descriptor.colorAttachments[0].pixelFormat = self.view.colorPixelFormat;
|
||||
descriptor.sampleCount = self.view.sampleCount;
|
||||
}
|
||||
|
||||
-(id<MTLCommandQueue>)commandQueueFor:(OSDRenderer *)renderer {
|
||||
return _commandQueue;
|
||||
}
|
||||
|
||||
-(id<MTLDevice>)deviceFor:(OSDRenderer *)renderer {
|
||||
return _device;
|
||||
}
|
||||
|
||||
-(MTLRenderPassDescriptor *)renderPassDescriptorFor:(OSDRenderer *)renderer {
|
||||
return self.view.currentRenderPassDescriptor;
|
||||
}
|
||||
@end
|
||||
12
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/main.m
vendored
Normal file
12
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/OSX/main.m
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Copyright 2015 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
return NSApplicationMain(argc, argv);
|
||||
}
|
||||
16
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/AppDelegate.h
vendored
Normal file
16
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/AppDelegate.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Copyright 2013 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
44
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/AppDelegate.m
vendored
Normal file
44
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/AppDelegate.m
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Copyright 2013 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
27
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/Base.lproj/LaunchScreen.storyboard
vendored
Normal file
27
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/Base.lproj/LaunchScreen.storyboard
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11119"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1024" height="1366"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
279
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/Base.lproj/Main.storyboard
vendored
Normal file
279
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/Base.lproj/Main.storyboard
vendored
Normal file
@@ -0,0 +1,279 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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="14490.49"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<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="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"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="BYZ-38-t0r" id="jd1-qJ-49i"/>
|
||||
<outlet property="delegate" destination="BYZ-38-t0r" id="OdV-ot-p6a"/>
|
||||
</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" 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="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">
|
||||
<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" 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"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="BYZ-38-t0r" id="4w5-fv-wIj"/>
|
||||
<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>
|
||||
<constraint firstItem="P8z-O2-OLV" firstAttribute="leading" secondItem="esT-7h-XLG" secondAttribute="trailing" constant="8" id="0zt-WU-LC3"/>
|
||||
<constraint firstItem="eYp-5M-Rgk" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="2nS-t9-ncz"/>
|
||||
<constraint firstItem="fw1-9C-P6U" firstAttribute="top" secondItem="5Ns-3P-r13" secondAttribute="bottom" constant="8" id="404-z0-Fv7"/>
|
||||
<constraint firstItem="8kP-4Y-wzA" firstAttribute="leading" secondItem="FvR-NK-6s0" secondAttribute="trailing" constant="8" id="5rd-n5-Uxl"/>
|
||||
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="oQb-3T-gg6" secondAttribute="bottom" constant="20" id="6dr-og-11f"/>
|
||||
<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="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="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="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"/>
|
||||
<constraint firstItem="7yA-a6-Sq7" firstAttribute="leading" secondItem="ioY-T2-PEM" secondAttribute="trailing" constant="8" id="cqL-gl-vn2"/>
|
||||
<constraint firstItem="fw1-9C-P6U" firstAttribute="leading" secondItem="5xP-bY-PgM" secondAttribute="trailing" constant="8" id="dhX-z5-kgA"/>
|
||||
<constraint firstItem="jQK-WK-vfP" firstAttribute="top" secondItem="7yA-a6-Sq7" secondAttribute="bottom" constant="8" id="egb-qP-Lva"/>
|
||||
<constraint firstItem="5Ns-3P-r13" firstAttribute="centerY" secondItem="Iw4-VH-Zwm" secondAttribute="centerY" id="fEO-gM-cmZ"/>
|
||||
<constraint firstItem="QQ6-5o-gla" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="ggj-9I-tbQ"/>
|
||||
<constraint firstItem="5Ns-3P-r13" firstAttribute="trailing" secondItem="8kP-4Y-wzA" secondAttribute="trailing" id="gqA-q9-SK3"/>
|
||||
<constraint firstItem="Ze8-2s-lED" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="20" id="kTX-YC-JKR"/>
|
||||
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="jQK-WK-vfP" secondAttribute="bottom" constant="20" id="kuT-qk-ibg"/>
|
||||
<constraint firstItem="8kP-4Y-wzA" firstAttribute="centerY" secondItem="FvR-NK-6s0" secondAttribute="centerY" id="n3L-qM-7Pr"/>
|
||||
<constraint firstItem="fw1-9C-P6U" firstAttribute="centerY" secondItem="5xP-bY-PgM" secondAttribute="centerY" id="nP1-Bt-GuV"/>
|
||||
<constraint firstItem="oQb-3T-gg6" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="pIi-zk-crx"/>
|
||||
<constraint firstItem="5xP-bY-PgM" firstAttribute="leading" secondItem="jQK-WK-vfP" secondAttribute="trailing" constant="20" id="pvx-Go-b8B"/>
|
||||
<constraint firstItem="5Ns-3P-r13" firstAttribute="top" secondItem="P8z-O2-OLV" secondAttribute="bottom" constant="8" id="pwK-2F-IIf"/>
|
||||
<constraint firstItem="P8z-O2-OLV" firstAttribute="top" secondItem="8kP-4Y-wzA" secondAttribute="bottom" constant="8" id="q11-mD-QDz"/>
|
||||
<constraint firstItem="oQb-3T-gg6" firstAttribute="top" secondItem="eYp-5M-Rgk" secondAttribute="bottom" constant="8" id="qfG-FK-QD4"/>
|
||||
<constraint firstItem="P8z-O2-OLV" firstAttribute="trailing" secondItem="8kP-4Y-wzA" secondAttribute="trailing" id="rha-qA-vsj"/>
|
||||
<constraint firstItem="8Ky-iT-gpT" firstAttribute="top" secondItem="eYp-5M-Rgk" secondAttribute="bottom" constant="8" id="rjU-ER-xAm"/>
|
||||
<constraint firstItem="fw1-9C-P6U" firstAttribute="trailing" secondItem="8kP-4Y-wzA" secondAttribute="trailing" id="ro3-hx-iLk"/>
|
||||
<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"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="qfG-FK-QD4"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="backfaceCullingSwitch" destination="5Ns-3P-r13" id="n8X-2V-BRl"/>
|
||||
<outlet property="backpatchCullingSwitch" destination="P8z-O2-OLV" id="VIe-Lv-hsC"/>
|
||||
<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="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"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="476.57393850658855" y="533.7890625"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<color key="tintColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</document>
|
||||
50
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/Info.plist
vendored
Normal file
50
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/Info.plist
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>mtlViewer</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.osd.mtlViewer</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>mtlViewer</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>metal</string>
|
||||
</array>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
42
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/ViewController.h
vendored
Normal file
42
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/ViewController.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Copyright 2013 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import "../mtlViewer.h"
|
||||
|
||||
@interface ViewController : UIViewController<
|
||||
MTKViewDelegate,
|
||||
UIPickerViewDelegate,
|
||||
UIPickerViewDataSource,
|
||||
OSDRendererDelegate
|
||||
>
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *refLvlLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *tesLvLlabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *frameTimeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIPickerView *modelPickerView;
|
||||
@property (weak, nonatomic) IBOutlet UIPickerView *shadingModePickerView;
|
||||
@property (weak, nonatomic) IBOutlet UIStepper *tessellationStepper;
|
||||
@property (weak, nonatomic) IBOutlet UIStepper *refinementStepper;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *wireframeSwitch;
|
||||
@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;
|
||||
- (IBAction)stepperChanged:(UIStepper *)sender;
|
||||
- (IBAction)switchChanged:(UISwitch *)sender;
|
||||
- (IBAction)endcapChanged:(UISegmentedControl *)sender;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
264
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/ViewController.mm
vendored
Normal file
264
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/ViewController.mm
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
//
|
||||
// Copyright 2013 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#import "ViewController.h"
|
||||
|
||||
#define FRAME_HISTORY 30
|
||||
@interface ViewController ()
|
||||
{
|
||||
dispatch_semaphore_t _frameSemaphore;
|
||||
CGPoint _startTouch;
|
||||
bool _isTouching;
|
||||
OSDRenderer* _osdRenderer;
|
||||
MTKView* _view;
|
||||
id<MTLDevice> _device;
|
||||
id<MTLCommandQueue> _commandQueue;
|
||||
|
||||
double _frameTimes[FRAME_HISTORY];
|
||||
uint64_t _currentFrame;
|
||||
|
||||
UIPanGestureRecognizer *_zoomGesture;
|
||||
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
-(void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size {
|
||||
_osdRenderer.camera->aspectRatio = size.width / size.height;
|
||||
}
|
||||
|
||||
-(void)drawInMTKView:(MTKView *)view {
|
||||
dispatch_semaphore_wait(_frameSemaphore, DISPATCH_TIME_FOREVER);
|
||||
auto commandBuffer = [_commandQueue commandBuffer];
|
||||
[[_osdRenderer drawFrame:commandBuffer] endEncoding];
|
||||
|
||||
__weak auto blockSemaphore = _frameSemaphore;
|
||||
unsigned frameIndex = _currentFrame % FRAME_HISTORY;
|
||||
const auto beginTime = CACurrentMediaTime();
|
||||
[commandBuffer addCompletedHandler:^(id<MTLCommandBuffer> _Nonnull c) {
|
||||
dispatch_semaphore_signal(blockSemaphore);
|
||||
_frameTimes[frameIndex] = CACurrentMediaTime() - beginTime;
|
||||
}];
|
||||
[commandBuffer presentDrawable:_view.currentDrawable];
|
||||
[commandBuffer commit];
|
||||
_currentFrame++;
|
||||
|
||||
double frameAverage = 0;
|
||||
for(auto& x : _frameTimes)
|
||||
frameAverage += x;
|
||||
|
||||
frameAverage /= 30.0;
|
||||
|
||||
_frameTimeLabel.text = [NSString stringWithFormat:@"%0.2f ms", frameAverage * 1000.0];
|
||||
}
|
||||
|
||||
-(UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
||||
return UIInterfaceOrientationMaskLandscape;
|
||||
}
|
||||
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
_view = (MTKView*)self.view;
|
||||
_frameSemaphore = dispatch_semaphore_create(3);
|
||||
|
||||
_device = MTLCreateSystemDefaultDevice();
|
||||
_commandQueue = [_device newCommandQueue];
|
||||
|
||||
_view.device = _device;
|
||||
_view.depthStencilPixelFormat = MTLPixelFormatDepth32Float;
|
||||
_view.sampleCount = 2;
|
||||
_view.frame = CGRectMake(0, 0, 1920, 1080);
|
||||
_view.contentScaleFactor = 1;
|
||||
_view.clearColor = MTLClearColorMake(0.4245, 0.4167, 0.4245, 1);
|
||||
|
||||
_osdRenderer = [[OSDRenderer alloc] initWithDelegate:self];
|
||||
|
||||
_view.delegate = self;
|
||||
|
||||
_zoomGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_zoomView)];
|
||||
_zoomGesture.minimumNumberOfTouches = 2;
|
||||
_zoomGesture.maximumNumberOfTouches = 2;
|
||||
_zoomGesture.cancelsTouchesInView = true;
|
||||
|
||||
[_view addGestureRecognizer:_zoomGesture];
|
||||
|
||||
|
||||
[self _applyOptions];
|
||||
}
|
||||
|
||||
-(void)_applyOptions {
|
||||
_osdRenderer.useSmoothCornerPatch = _smoothCornerSwitch.isOn;
|
||||
_osdRenderer.useSingleCreasePatch = _singleCreaseSwitch.isOn;
|
||||
_osdRenderer.useInfinitelySharpPatch = _infinitelySharpSwitch.isOn;
|
||||
_osdRenderer.usePatchBackfaceCulling = _backpatchCullingSwitch.isOn;
|
||||
_osdRenderer.usePrimitiveBackfaceCulling = _backfaceCullingSwitch.isOn;
|
||||
_osdRenderer.useScreenspaceTessellation = _screenspaceTessellationSwitch.isOn;
|
||||
_osdRenderer.displayStyle = _wireframeSwitch.isOn ? kDisplayStyleWireOnShaded : kDisplayStyleShaded;
|
||||
_osdRenderer.displayControlMeshVertices = _controlMeshSwitch.isOn;
|
||||
_osdRenderer.displayControlMeshEdges = _controlMeshSwitch.isOn;
|
||||
_osdRenderer.usePatchClipCulling = _patchClipCullingSwitch.isOn;
|
||||
_osdRenderer.useFractionalTessellation = _osdRenderer.useFractionalTessellation;
|
||||
_osdRenderer.useAdaptive = true;
|
||||
_osdRenderer.freeze = true;
|
||||
_osdRenderer.animateVertices = false;
|
||||
_osdRenderer.kernelType = kMetal;
|
||||
_osdRenderer.refinementLevel = _refinementStepper.value;
|
||||
_osdRenderer.tessellationLevel = _tessellationStepper.value;
|
||||
_osdRenderer.endCapMode = (EndCap)(_endcapSegmentedControl.selectedSegmentIndex);
|
||||
|
||||
_tesLvLlabel.text = [NSString stringWithFormat:@"Tes Lvl. %d", (int)_osdRenderer.tessellationLevel];
|
||||
[_tesLvLlabel sizeToFit];
|
||||
|
||||
_refLvlLabel.text = [NSString stringWithFormat:@"Ref Lvl. %d", _osdRenderer.refinementLevel];
|
||||
[_refLvlLabel sizeToFit];
|
||||
}
|
||||
|
||||
-(void)_zoomView {
|
||||
static float lastY = 0;
|
||||
if(_zoomGesture.state == UIGestureRecognizerStateBegan) {
|
||||
lastY = [_zoomGesture translationInView:_view].y;
|
||||
} else if(_zoomGesture.state == UIGestureRecognizerStateChanged) {
|
||||
const auto currentY = [_zoomGesture translationInView:_view].y;
|
||||
const auto deltaY = (currentY - lastY) / 100.0;
|
||||
lastY = currentY;
|
||||
_osdRenderer.camera->dollyDistance += deltaY;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||
_isTouching = true;
|
||||
_startTouch = [touches.anyObject locationInView:self.view];
|
||||
[super touchesBegan:touches withEvent:event];
|
||||
}
|
||||
|
||||
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||
_isTouching = false;
|
||||
[super touchesEnded:touches withEvent:event];
|
||||
}
|
||||
|
||||
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||
if(_isTouching)
|
||||
{
|
||||
for(UITouch* touch in touches)
|
||||
{
|
||||
CGPoint location = [touch locationInView:self.view];
|
||||
_startTouch = [touch previousLocationInView:self.view];
|
||||
|
||||
double deltaX = location.x - _startTouch.x;
|
||||
double deltaY = location.y - _startTouch.y;
|
||||
|
||||
_osdRenderer.camera->rotationX += deltaX / 5.0;
|
||||
_osdRenderer.camera->rotationY += deltaY / 5.0;
|
||||
}
|
||||
}
|
||||
[super touchesMoved:touches withEvent:event];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
-(id<MTLDevice>)deviceFor:(OSDRenderer *)renderer {
|
||||
return _device;
|
||||
}
|
||||
-(id<MTLCommandQueue>)commandQueueFor:(OSDRenderer *)renderer {
|
||||
return _commandQueue;
|
||||
}
|
||||
-(MTLRenderPassDescriptor *)renderPassDescriptorFor:(OSDRenderer *)renderer {
|
||||
return _view.currentRenderPassDescriptor;
|
||||
}
|
||||
-(void)setupDepthStencilState:(MTLDepthStencilDescriptor *)descriptor for:(OSDRenderer *)renderer {
|
||||
|
||||
}
|
||||
-(void)setupRenderPipelineState:(MTLRenderPipelineDescriptor *)descriptor for:(OSDRenderer *)renderer {
|
||||
descriptor.colorAttachments[0].pixelFormat = _view.colorPixelFormat;
|
||||
descriptor.depthAttachmentPixelFormat = _view.depthStencilPixelFormat;
|
||||
descriptor.sampleCount = _view.sampleCount;
|
||||
}
|
||||
- (IBAction)stepperChanged:(UIStepper *)sender {
|
||||
if(sender == _tessellationStepper) {
|
||||
_osdRenderer.tessellationLevel = sender.value;
|
||||
_tesLvLlabel.text = [NSString stringWithFormat:@"Tes Lvl. %d", (int)_osdRenderer.tessellationLevel];
|
||||
[_tesLvLlabel sizeToFit];
|
||||
|
||||
} else if (sender == _refinementStepper) {
|
||||
_osdRenderer.refinementLevel = sender.value;
|
||||
_refLvlLabel.text = [NSString stringWithFormat:@"Ref Lvl. %d", _osdRenderer.refinementLevel];
|
||||
[_refLvlLabel sizeToFit];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)switchChanged:(UISwitch *)sender {
|
||||
if(sender == _wireframeSwitch) {
|
||||
_osdRenderer.displayStyle = _wireframeSwitch.isOn ? kDisplayStyleWireOnShaded : kDisplayStyleShaded;
|
||||
} else if(sender == _backpatchCullingSwitch) {
|
||||
_osdRenderer.usePatchBackfaceCulling = sender.isOn;
|
||||
} else if(sender == _backfaceCullingSwitch) {
|
||||
_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.useSingleCreasePatch = sender.isOn;
|
||||
} else if(sender == _infinitelySharpSwitch) {
|
||||
_osdRenderer.useInfinitelySharpPatch = sender.isOn;
|
||||
} else if(sender == _controlMeshSwitch) {
|
||||
_osdRenderer.displayControlMeshEdges = sender.isOn;
|
||||
_osdRenderer.displayControlMeshVertices = sender.isOn;
|
||||
} else if(sender == _screenspaceTessellationSwitch) {
|
||||
_osdRenderer.useScreenspaceTessellation = sender.isOn;
|
||||
_osdRenderer.useFractionalTessellation = _osdRenderer.useFractionalTessellation;
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)endcapChanged:(UISegmentedControl *)sender {
|
||||
_osdRenderer.endCapMode = (EndCap)(sender.selectedSegmentIndex);
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
|
||||
if(pickerView == _modelPickerView) {
|
||||
return _osdRenderer.loadedModels.count;
|
||||
} else if(pickerView == _shadingModePickerView) {
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
|
||||
if(pickerView == _modelPickerView) {
|
||||
return _osdRenderer.loadedModels[row];
|
||||
} else if(pickerView == _shadingModePickerView) {
|
||||
switch((ShadingMode)row) {
|
||||
case kShadingMaterial: return @"Material";
|
||||
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 @"";
|
||||
}
|
||||
|
||||
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
|
||||
if(pickerView == _modelPickerView) {
|
||||
_osdRenderer.currentModel = _osdRenderer.loadedModels[row];
|
||||
} else if(pickerView == _shadingModePickerView) {
|
||||
_osdRenderer.shadingMode = (ShadingMode)row;
|
||||
}
|
||||
}
|
||||
@end
|
||||
8
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/main.m
vendored
Normal file
8
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/iOS/main.m
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
82
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/init_shapes.h
vendored
Normal file
82
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/init_shapes.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// Copyright 2013 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#include "../../regression/common/shape_utils.h"
|
||||
#include "../../regression/shapes/all.h"
|
||||
|
||||
|
||||
static std::vector<ShapeDesc> g_defaultShapes;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void initShapes() {
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_toroidal_tet", catmark_toroidal_tet, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_cube", catmark_cube, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_cubes_semisharp", catmark_cubes_semisharp, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_cubes_infsharp", catmark_cubes_infsharp, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_pyramid", catmark_pyramid, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_pyramid_creases0", catmark_pyramid_creases0, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_pyramid_creases1", catmark_pyramid_creases1, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_torus", catmark_torus, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_torus_creases1", catmark_torus_creases1, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_edgenone", catmark_edgenone, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_xord_interior", catmark_xord_interior, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_xord_boundary", catmark_xord_boundary, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_val2_interior", catmark_val2_interior, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_nonquads", catmark_nonquads, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_single_crease", catmark_single_crease, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_inf_crease0", catmark_inf_crease0, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_inf_crease1", catmark_inf_crease1, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_nonman_verts", catmark_nonman_verts, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_nonman_edges", catmark_nonman_edges, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_hole_test1", catmark_hole_test1, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_hole_test2", catmark_hole_test2, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_hole_test3", catmark_hole_test3, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_hole_test4", catmark_hole_test4, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_smoothtris0", catmark_smoothtris0, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_smoothtris1", catmark_smoothtris1, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_pole8", catmark_pole8, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_pole64", catmark_pole64, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_nonman_quadpole64",catmark_nonman_quadpole64,kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_nonman_edge100", catmark_nonman_edge100, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_helmet", catmark_helmet, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_bishop", catmark_bishop, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_pawn", catmark_pawn, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_rook", catmark_rook, kCatmark));
|
||||
g_defaultShapes.push_back(ShapeDesc("catmark_car", catmark_car, kCatmark));
|
||||
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_toroidal_tet", loop_toroidal_tet, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_tetrahedron", loop_tetrahedron, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_cube", loop_cube, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_triangle_edgenone", loop_triangle_edgenone, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_nonman_verts", loop_nonman_verts, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_nonman_edges", loop_nonman_edges, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_pole64", loop_pole64, kLoop));
|
||||
g_defaultShapes.push_back(ShapeDesc("loop_nonman_edge100", loop_nonman_edge100, kLoop));
|
||||
|
||||
g_defaultShapes.push_back(ShapeDesc("bilinear_cube", bilinear_cube, kBilinear));
|
||||
g_defaultShapes.push_back(ShapeDesc("bilinear_nonplanar", bilinear_nonplanar, kBilinear));
|
||||
g_defaultShapes.push_back(ShapeDesc("bilinear_nonquads0", bilinear_nonquads0, kBilinear));
|
||||
g_defaultShapes.push_back(ShapeDesc("bilinear_nonquads1", bilinear_nonquads1, kBilinear));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
109
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/mtlViewer.h
vendored
Normal file
109
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/mtlViewer.h
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// Copyright 2015 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
typedef enum {
|
||||
kEndCapBilinearBasis = 0,
|
||||
kEndCapBSplineBasis,
|
||||
kEndCapGregoryBasis,
|
||||
kEndCapLegacyGregory,
|
||||
} EndCap;
|
||||
|
||||
typedef enum {
|
||||
kFVarLinearNone = 0,
|
||||
kFVarLinearCornersOnly,
|
||||
kFVarLinearCornersPlus1,
|
||||
kFVarLinearCornersPlus2,
|
||||
kFVarLinearBoundaries,
|
||||
kFVarLinearAll
|
||||
} FVarLinearInterp;
|
||||
|
||||
typedef enum {
|
||||
kCPU = 0,
|
||||
kMetal,
|
||||
} KernelType;
|
||||
|
||||
typedef enum {
|
||||
kDisplayStyleWire = 0,
|
||||
kDisplayStyleShaded,
|
||||
kDisplayStyleWireOnShaded,
|
||||
} DisplayStyle;
|
||||
|
||||
typedef enum {
|
||||
kShadingMaterial = 0,
|
||||
kShadingFaceVaryingColor,
|
||||
kShadingPatchType,
|
||||
kShadingPatchDepth,
|
||||
kShadingPatchCoord,
|
||||
kShadingNormal,
|
||||
} ShadingMode;
|
||||
|
||||
typedef struct {
|
||||
float rotationX;
|
||||
float rotationY;
|
||||
float dollyDistance;
|
||||
float aspectRatio;
|
||||
} Camera;
|
||||
|
||||
@class OSDRenderer;
|
||||
|
||||
@protocol OSDRendererDelegate <NSObject>
|
||||
-(id<MTLDevice>)deviceFor:(OSDRenderer*)renderer;
|
||||
-(id<MTLCommandQueue>)commandQueueFor:(OSDRenderer*)renderer;
|
||||
-(MTLRenderPassDescriptor*)renderPassDescriptorFor:(OSDRenderer*)renderer;
|
||||
-(void)setupDepthStencilState:(MTLDepthStencilDescriptor*)descriptor for:(OSDRenderer*)renderer;
|
||||
-(void)setupRenderPipelineState:(MTLRenderPipelineDescriptor*)descriptor for:(OSDRenderer*)renderer;
|
||||
@end
|
||||
|
||||
@interface OSDRenderer : NSObject
|
||||
|
||||
-(instancetype)initWithDelegate:(id<OSDRendererDelegate>)delegate;
|
||||
|
||||
-(id<MTLRenderCommandEncoder>)drawFrame:(id<MTLCommandBuffer>)commandBuffer;
|
||||
|
||||
-(void)fitFrame;
|
||||
|
||||
@property (readonly, nonatomic) id<OSDRendererDelegate> delegate;
|
||||
|
||||
@property (nonatomic) unsigned refinementLevel;
|
||||
@property (nonatomic) int tessellationLevel;
|
||||
|
||||
@property (readonly, nonatomic) NSArray<NSString*>* loadedModels;
|
||||
@property (nonatomic) NSString* currentModel;
|
||||
|
||||
@property (readonly, nonatomic) Camera* camera;
|
||||
|
||||
@property (readonly, nonatomic) int* patchCounts;
|
||||
|
||||
@property (nonatomic) bool useFractionalTessellation;
|
||||
@property (nonatomic) bool useScreenspaceTessellation;
|
||||
@property (nonatomic) bool usePatchIndexBuffer;
|
||||
@property (nonatomic) bool usePatchBackfaceCulling;
|
||||
@property (nonatomic) bool usePatchClipCulling;
|
||||
@property (nonatomic) bool useSmoothCornerPatch;
|
||||
@property (nonatomic) bool useSingleCreasePatch;
|
||||
@property (nonatomic) bool useInfinitelySharpPatch;
|
||||
@property (nonatomic) bool useStageIn;
|
||||
@property (nonatomic) bool usePrimitiveBackfaceCulling;
|
||||
@property (nonatomic) bool useAdaptive;
|
||||
@property (nonatomic) bool yup;
|
||||
@property (nonatomic) bool freeze;
|
||||
@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) FVarLinearInterp fVarLinearInterp;
|
||||
@property (nonatomic) KernelType kernelType;
|
||||
|
||||
@end
|
||||
753
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/mtlViewer.metal
vendored
Normal file
753
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/mtlViewer.metal
vendored
Normal file
@@ -0,0 +1,753 @@
|
||||
#line 0 "examples/mtlViewer/mtlViewer.metal"
|
||||
|
||||
//
|
||||
// Copyright 2013 Pixar
|
||||
//
|
||||
// Licensed under the terms set forth in the LICENSE.txt file available at
|
||||
// https://opensubdiv.org/license.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
|
||||
#if OSD_IS_ADAPTIVE
|
||||
static_assert(!OSD_ENABLE_SCREENSPACE_TESSELLATION || !USE_PTVS_FACTORS, "USE_PTVS_FACTORS cannot be enabled if OSD_ENABLE_SCREENSPACE_TESSELLATION is enabled");
|
||||
#endif
|
||||
|
||||
#define SHADING_TYPE_MATERIAL 0
|
||||
#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;
|
||||
float4x4 ProjectionMatrix;
|
||||
float4x4 ModelViewProjectionMatrix;
|
||||
float4x4 ModelViewInverseMatrix;
|
||||
float TessLevel;
|
||||
};
|
||||
|
||||
struct OutputVertex {
|
||||
float4 positionOut [[position]];
|
||||
float3 position;
|
||||
float3 normal;
|
||||
#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
|
||||
};
|
||||
|
||||
struct SolidColorVertex {
|
||||
float4 positionOut [[position]];
|
||||
|
||||
half4 getColor() const {
|
||||
return unpack_unorm4x8_to_half(_color);
|
||||
}
|
||||
|
||||
void setColor(half4 color) {
|
||||
_color = pack_half_to_unorm4x8(color);
|
||||
}
|
||||
|
||||
private:
|
||||
uint _color [[flat, user(color)]];
|
||||
};
|
||||
|
||||
struct PackedInputVertex {
|
||||
packed_float3 position;
|
||||
};
|
||||
|
||||
struct Light {
|
||||
float3 Position;
|
||||
float3 ambient;
|
||||
float3 diffuse;
|
||||
float3 specular;
|
||||
};
|
||||
|
||||
float3 lighting(float3 diffuseColor, const constant Light* lightData, float3 eyePos, float3 eyeN)
|
||||
{
|
||||
|
||||
float3 color(0);
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
const auto l = lightData[i].Position;
|
||||
const auto h = normalize(l + float3(0,0,1));
|
||||
const auto d = max(0.0, dot(eyeN, l));
|
||||
const auto s = powr(max(0.0, dot(eyeN, h)), 500.0f);
|
||||
|
||||
color += lightData[i].ambient
|
||||
+ d * lightData[i].diffuse * diffuseColor
|
||||
+ s * lightData[i].specular;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
const constant float4 patchColors[] = {
|
||||
float4(1.0f, 1.0f, 1.0f, 1.0f), // regular
|
||||
float4(0.0f, 1.0f, 1.0f, 1.0f), // regular pattern 0
|
||||
float4(0.0f, 0.5f, 1.0f, 1.0f), // regular pattern 1
|
||||
float4(0.0f, 0.5f, 0.5f, 1.0f), // regular pattern 2
|
||||
float4(0.5f, 0.0f, 1.0f, 1.0f), // regular pattern 3
|
||||
float4(1.0f, 0.5f, 1.0f, 1.0f), // regular pattern 4
|
||||
|
||||
float4(1.0f, 0.5f, 0.5f, 1.0f), // single crease
|
||||
float4(1.0f, 0.70f, 0.6f, 1.0f), // single crease pattern 0
|
||||
float4(1.0f, 0.65f, 0.6f, 1.0f), // single crease pattern 1
|
||||
float4(1.0f, 0.60f, 0.6f, 1.0f), // single crease pattern 2
|
||||
float4(1.0f, 0.55f, 0.6f, 1.0f), // single crease pattern 3
|
||||
float4(1.0f, 0.50f, 0.6f, 1.0f), // single crease pattern 4
|
||||
|
||||
float4(0.8f, 0.0f, 0.0f, 1.0f), // boundary
|
||||
float4(0.0f, 0.0f, 0.75f, 1.0f), // boundary pattern 0
|
||||
float4(0.0f, 0.2f, 0.75f, 1.0f), // boundary pattern 1
|
||||
float4(0.0f, 0.4f, 0.75f, 1.0f), // boundary pattern 2
|
||||
float4(0.0f, 0.6f, 0.75f, 1.0f), // boundary pattern 3
|
||||
float4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
||||
|
||||
float4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
||||
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
|
||||
float4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||
float4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||
float4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||
float4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||
|
||||
float4(1.0f, 0.5f, 0.0f, 1.0f), // gregory boundary
|
||||
float4(1.0f, 0.5f, 0.0f, 1.0f), // gregory boundary
|
||||
float4(1.0f, 0.5f, 0.0f, 1.0f), // gregory boundary
|
||||
float4(1.0f, 0.5f, 0.0f, 1.0f), // gregory boundary
|
||||
float4(1.0f, 0.5f, 0.0f, 1.0f), // gregory boundary
|
||||
float4(1.0f, 0.5f, 0.0f, 1.0f), // gregory boundary
|
||||
|
||||
float4(1.0f, 0.7f, 0.3f, 1.0f), // gregory basis
|
||||
float4(1.0f, 0.7f, 0.3f, 1.0f), // gregory basis
|
||||
float4(1.0f, 0.7f, 0.3f, 1.0f), // gregory basis
|
||||
float4(1.0f, 0.7f, 0.3f, 1.0f), // gregory basis
|
||||
float4(1.0f, 0.7f, 0.3f, 1.0f), // gregory basis
|
||||
float4(1.0f, 0.7f, 0.3f, 1.0f) // gregory basis
|
||||
};
|
||||
|
||||
float4
|
||||
getAdaptivePatchColor(int3 patchParam
|
||||
#if OSD_PATCH_ENABLE_SINGLE_CREASE
|
||||
, float2 vSegments
|
||||
#else
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
int patchType = 0;
|
||||
|
||||
int edgeCount = popcount(OsdGetPatchBoundaryMask(patchParam));
|
||||
if (edgeCount == 1) {
|
||||
patchType = 2; // BOUNDARY
|
||||
}
|
||||
if (edgeCount > 1) {
|
||||
patchType = 3; // CORNER
|
||||
}
|
||||
|
||||
#if OSD_PATCH_ENABLE_SINGLE_CREASE
|
||||
// check this after boundary/corner since single crease patch also has edgeCount.
|
||||
if (vSegments.y > 0) {
|
||||
patchType = 1;
|
||||
}
|
||||
#elif OSD_PATCH_GREGORY
|
||||
patchType = 4;
|
||||
#elif OSD_PATCH_GREGORY_BOUNDARY
|
||||
patchType = 5;
|
||||
#elif OSD_PATCH_GREGORY_BASIS
|
||||
patchType = 6;
|
||||
#elif OSD_PATCH_GREGORY_TRIANGLE
|
||||
patchType = 6;
|
||||
#endif
|
||||
|
||||
int pattern = popcount(OsdGetPatchTransitionMask(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 || OSD_PATCH_BOX_SPLINE_TRIANGLE
|
||||
struct ControlPoint
|
||||
{
|
||||
float3 P [[attribute(0)]];
|
||||
#if OSD_PATCH_ENABLE_SINGLE_CREASE
|
||||
float3 P1 [[attribute(1)]];
|
||||
float3 P2 [[attribute(2)]];
|
||||
#if !USE_PTVS_SHARPNESS
|
||||
float2 vSegments [[attribute(3)]];
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#elif OSD_PATCH_GREGORY || OSD_PATCH_GREGORY_BOUNDARY
|
||||
struct ControlPoint
|
||||
{
|
||||
float3 P [[attribute(0)]];
|
||||
float3 Ep [[attribute(1)]];
|
||||
float3 Em [[attribute(2)]];
|
||||
float3 Fp [[attribute(3)]];
|
||||
float3 Fm [[attribute(4)]];
|
||||
};
|
||||
#elif OSD_PATCH_GREGORY_BASIS || OSD_PATCH_GREGORY_TRIANGLE
|
||||
struct ControlPoint
|
||||
{
|
||||
float3 position [[attribute(0)]];
|
||||
};
|
||||
#endif
|
||||
|
||||
struct PatchInput
|
||||
{
|
||||
patch_control_point<ControlPoint> cv;
|
||||
#if !USE_PTVS_FACTORS
|
||||
float4 tessOuterLo [[attribute(5)]];
|
||||
float4 tessOuterHi [[attribute(6)]];
|
||||
#endif
|
||||
int3 patchParam [[attribute(10)]];
|
||||
};
|
||||
#endif
|
||||
|
||||
#if OSD_PATCH_REGULAR || OSD_PATCH_GREGORY_BASIS || OSD_PATCH_GREGORY || OSD_PATCH_GREGORY_BOUNDARY
|
||||
typedef MTLQuadTessellationFactorsHalf PatchTessFactors;
|
||||
#elif OSD_PATCH_BOX_SPLINE_TRIANGLE || OSD_PATCH_GREGORY_TRIANGLE
|
||||
typedef MTLTriangleTessellationFactorsHalf PatchTessFactors;
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
// OSD Kernel
|
||||
//----------------------------------------------------------
|
||||
//The user of OSD should define this kernel which serves as the landing point for all patch computation
|
||||
//This compute function should just be copied and pasted, modifying the section under "User Vertex Transform"
|
||||
//Or the entire function may be moddified as needed (for example to add a patch index buffer)
|
||||
kernel void compute_main(
|
||||
const constant PerFrameConstants& frameConsts [[buffer(FRAME_CONST_BUFFER_INDEX)]],
|
||||
unsigned thread_position_in_grid [[thread_position_in_grid]],
|
||||
unsigned thread_position_in_threadgroup [[thread_position_in_threadgroup]],
|
||||
unsigned threadgroup_position_in_grid [[threadgroup_position_in_grid]],
|
||||
OsdPatchParamBufferSet osdBuffers, //This struct contains all of the buffers needed by OSD
|
||||
device PatchTessFactors* patchTessellationFactors [[buffer(PATCH_TESSFACTORS_INDEX)]]
|
||||
#if OSD_USE_PATCH_INDEX_BUFFER
|
||||
,device unsigned* patchIndex [[buffer(OSD_PATCH_INDEX_BUFFER_INDEX)]]
|
||||
,device MTLDrawPatchIndirectArguments* drawIndirectCommands [[buffer(OSD_DRAWINDIRECT_BUFFER_INDEX)]]
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
//----------------------------------------------------------
|
||||
// OSD Kernel Setup
|
||||
//----------------------------------------------------------
|
||||
|
||||
#define PATCHES_PER_THREADGROUP (THREADS_PER_THREADGROUP / THREADS_PER_PATCH)
|
||||
int const primitiveID = thread_position_in_grid / THREADS_PER_PATCH;
|
||||
int const primitiveIDInTG = thread_position_in_threadgroup / THREADS_PER_PATCH;
|
||||
int const vertexIndex = threadgroup_position_in_grid * PATCHES_PER_THREADGROUP * CONTROL_POINTS_PER_PATCH +
|
||||
thread_position_in_threadgroup * CONTROL_POINTS_PER_THREAD;
|
||||
int const vertexIndexInTG = thread_position_in_threadgroup * CONTROL_POINTS_PER_THREAD;
|
||||
int const invocationID = (thread_position_in_threadgroup * VERTEX_CONTROL_POINTS_PER_THREAD) % (THREADS_PER_PATCH*VERTEX_CONTROL_POINTS_PER_THREAD);
|
||||
|
||||
//Contains the shared patchParam value used by all threads that act upon a single patch
|
||||
//the .z (sharpness) field is set to -1 (NAN) if that patch should be culled to signal other threads to return.
|
||||
threadgroup int3 patchParam[PATCHES_PER_THREADGROUP];
|
||||
threadgroup PatchVertexType patchVertices[PATCHES_PER_THREADGROUP * CONTROL_POINTS_PER_PATCH];
|
||||
|
||||
//----------------------------------------------------------
|
||||
// OSD Vertex Transform
|
||||
//----------------------------------------------------------
|
||||
{
|
||||
patchParam[primitiveIDInTG] = OsdGetPatchParam(primitiveID, osdBuffers.patchParamBuffer);
|
||||
|
||||
for (unsigned threadOffset = 0; threadOffset < CONTROL_POINTS_PER_THREAD; ++threadOffset)
|
||||
{
|
||||
if (vertexIndexInTG + threadOffset < PATCHES_PER_THREADGROUP * CONTROL_POINTS_PER_PATCH)
|
||||
{
|
||||
const auto vertexId = osdBuffers.indexBuffer[(vertexIndex + threadOffset)];
|
||||
const auto v = osdBuffers.vertexBuffer[vertexId];
|
||||
|
||||
threadgroup auto& patchVertex = patchVertices[vertexIndexInTG + threadOffset];
|
||||
|
||||
//----------------------------------------------------------
|
||||
// User Vertex Transform
|
||||
//----------------------------------------------------------
|
||||
|
||||
OsdComputePerVertex(float4(v.position,1), patchVertex, vertexId, frameConsts.ModelViewProjectionMatrix, osdBuffers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NEEDS_BARRIER
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------
|
||||
// OSD Patch Cull
|
||||
//----------------------------------------------------------
|
||||
{
|
||||
auto patch = patchVertices + primitiveIDInTG * CONTROL_POINTS_PER_PATCH;
|
||||
|
||||
if (!OsdCullPerPatchVertex(patch, frameConsts.ModelViewMatrix))
|
||||
{
|
||||
#if !OSD_USE_PATCH_INDEX_BUFFER
|
||||
#if OSD_PATCH_REGULAR || OSD_PATCH_GREGORY_BASIS || OSD_PATCH_GREGORY || OSD_PATCH_GREGORY_BOUNDARY
|
||||
patchTessellationFactors[primitiveID].edgeTessellationFactor[0] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].edgeTessellationFactor[1] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].edgeTessellationFactor[2] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].edgeTessellationFactor[3] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].insideTessellationFactor[0] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].insideTessellationFactor[1] = 0.0h;
|
||||
#elif OSD_PATCH_BOX_SPLINE_TRIANGLE || OSD_PATCH_GREGORY_TRIANGLE
|
||||
patchTessellationFactors[primitiveID].edgeTessellationFactor[0] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].edgeTessellationFactor[1] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].edgeTessellationFactor[2] = 0.0h;
|
||||
patchTessellationFactors[primitiveID].insideTessellationFactor = 0.0h;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
patchParam[primitiveIDInTG].z = -1;
|
||||
#if !NEEDS_BARRIER
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if NEEDS_BARRIER
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------
|
||||
// OSD Patch Compute
|
||||
//----------------------------------------------------------
|
||||
if (patchParam[primitiveIDInTG].z != -1)
|
||||
{
|
||||
for (unsigned threadOffset = 0; threadOffset < VERTEX_CONTROL_POINTS_PER_THREAD; ++threadOffset)
|
||||
{
|
||||
if (invocationID + threadOffset < VERTEX_CONTROL_POINTS_PER_PATCH)
|
||||
{
|
||||
OsdComputePerPatchVertex(
|
||||
patchParam[primitiveIDInTG],
|
||||
invocationID + threadOffset,
|
||||
primitiveID,
|
||||
invocationID + threadOffset + primitiveID * VERTEX_CONTROL_POINTS_PER_PATCH,
|
||||
patchVertices + primitiveIDInTG * CONTROL_POINTS_PER_PATCH,
|
||||
osdBuffers
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NEEDS_BARRIER
|
||||
threadgroup_barrier(mem_flags::mem_device_and_threadgroup);
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------
|
||||
// OSD Tessellation Factors
|
||||
//----------------------------------------------------------
|
||||
if (invocationID == 0)
|
||||
{
|
||||
|
||||
#if OSD_USE_PATCH_INDEX_BUFFER
|
||||
const auto patchId = atomic_fetch_add_explicit((device atomic_uint*)&drawIndirectCommands->patchCount, 1, memory_order_relaxed);
|
||||
patchIndex[patchId] = primitiveID;
|
||||
#else
|
||||
const auto patchId = primitiveID;
|
||||
#endif
|
||||
|
||||
OsdComputePerPatchFactors(
|
||||
patchParam[primitiveIDInTG],
|
||||
frameConsts.TessLevel,
|
||||
primitiveID,
|
||||
frameConsts.ProjectionMatrix,
|
||||
frameConsts.ModelViewMatrix,
|
||||
osdBuffers,
|
||||
patchVertices + primitiveIDInTG * CONTROL_POINTS_PER_PATCH,
|
||||
patchTessellationFactors[patchId]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#if SHADING_TYPE == SHADING_TYPE_FACE_VARYING_COLOR
|
||||
float3
|
||||
interpolateFaceVaryingColor(
|
||||
int patch_id,
|
||||
float2 uv,
|
||||
const device float* fvarData,
|
||||
const device int* fvarIndices,
|
||||
const device packed_int3* fvarPatchParams,
|
||||
const constant int* fvarPatchArrays)
|
||||
{
|
||||
OsdPatchArray fvarPatchArray = OsdPatchArrayInit(
|
||||
fvarPatchArrays[0],
|
||||
fvarPatchArrays[1],
|
||||
fvarPatchArrays[2],
|
||||
fvarPatchArrays[3],
|
||||
fvarPatchArrays[4],
|
||||
fvarPatchArrays[5]);
|
||||
OsdPatchParam fvarParam = OsdPatchParamInit(
|
||||
fvarPatchParams[patch_id][0],
|
||||
fvarPatchParams[patch_id][1],
|
||||
fvarPatchParams[patch_id][2]);
|
||||
|
||||
int fvarPatchType = OsdPatchParamIsRegular(fvarParam)
|
||||
? fvarPatchArray.regDesc
|
||||
: fvarPatchArray.desc;
|
||||
|
||||
float wP[20], wDu[20], wDv[20], wDuu[20], wDuv[20], wDvv[20];
|
||||
int numPoints = OsdEvaluatePatchBasisNormalized(fvarPatchType, fvarParam,
|
||||
uv.x, uv.y, wP, wDu, wDv, wDuu, wDuv, wDvv);
|
||||
|
||||
int primOffset = patch_id * fvarPatchArray.stride;
|
||||
|
||||
float2 interpUV = float2(0);
|
||||
for (int i = 0; i < numPoints; ++i) {
|
||||
int index = fvarIndices[primOffset + i] * 2 /* OSD_FVAR_WIDTH */ + 0 /* fvarOffset */;
|
||||
float2 cv = float2(fvarData[index + 0], fvarData[index + 1]);
|
||||
interpUV += wP[i] * cv;
|
||||
}
|
||||
|
||||
return float3(interpUV, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OSD_PATCH_REGULAR || OSD_PATCH_GREGORY_BASIS || OSD_PATCH_GREGORY || OSD_PATCH_GREGORY_BOUNDARY
|
||||
[[patch(quad, VERTEX_CONTROL_POINTS_PER_PATCH)]]
|
||||
#elif OSD_PATCH_BOX_SPLINE_TRIANGLE || OSD_PATCH_GREGORY_TRIANGLE
|
||||
[[patch(triangle, VERTEX_CONTROL_POINTS_PER_PATCH)]]
|
||||
#endif
|
||||
vertex OutputVertex vertex_main(
|
||||
const constant PerFrameConstants& frameConsts [[buffer(FRAME_CONST_BUFFER_INDEX)]],
|
||||
#if USE_STAGE_IN
|
||||
const PatchInput patchInput [[stage_in]],
|
||||
#else
|
||||
const OsdVertexBufferSet patchInput,
|
||||
#endif
|
||||
const device float* osdFaceVaryingData [[buffer(OSD_FVAR_DATA_BUFFER_INDEX)]],
|
||||
const device int* osdFaceVaryingIndices [[buffer(OSD_FVAR_INDICES_BUFFER_INDEX)]],
|
||||
const device packed_int3* osdFaceVaryingPatchParams [[buffer(OSD_FVAR_PATCHPARAM_BUFFER_INDEX)]],
|
||||
const constant int* osdFaceVaryingPatchArrays [[buffer(OSD_FVAR_PATCH_ARRAYS_BUFFER_INDEX)]],
|
||||
#if OSD_PATCH_REGULAR || OSD_PATCH_GREGORY_BASIS || OSD_PATCH_GREGORY || OSD_PATCH_GREGORY_BOUNDARY
|
||||
float2 position_in_patch [[position_in_patch]],
|
||||
#elif OSD_PATCH_BOX_SPLINE_TRIANGLE || OSD_PATCH_GREGORY_TRIANGLE
|
||||
float3 position_in_patch [[position_in_patch]],
|
||||
#endif
|
||||
uint patch_id [[patch_id]]
|
||||
)
|
||||
{
|
||||
OutputVertex out;
|
||||
|
||||
#if USE_STAGE_IN
|
||||
int3 patchParam = patchInput.patchParam;
|
||||
#else
|
||||
int3 patchParam = patchInput.patchParamBuffer[patch_id];
|
||||
#endif
|
||||
|
||||
int refinementLevel = OsdGetPatchRefinementLevel(patchParam);
|
||||
float tessLevel = min(frameConsts.TessLevel, (float)OSD_MAX_TESS_LEVEL) /
|
||||
exp2((float)refinementLevel - 1);
|
||||
|
||||
auto patchVertex = OsdComputePatch(tessLevel, position_in_patch, patch_id, patchInput);
|
||||
|
||||
out.position = (frameConsts.ModelViewMatrix * float4(patchVertex.position, 1.0f)).xyz;
|
||||
out.positionOut = frameConsts.ModelViewProjectionMatrix * float4(patchVertex.position, 1.0f);
|
||||
|
||||
out.normal = mul(frameConsts.ModelViewMatrix, patchVertex.normal);
|
||||
#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_COLOR
|
||||
out.patchColor = interpolateFaceVaryingColor(
|
||||
patch_id,
|
||||
patchVertex.tessCoord.xy,
|
||||
osdFaceVaryingData,
|
||||
osdFaceVaryingIndices,
|
||||
osdFaceVaryingPatchParams,
|
||||
osdFaceVaryingPatchArrays);
|
||||
#endif
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OSD_PATCH_REGULAR
|
||||
const constant unsigned BSplineControlLineIndices[] = {
|
||||
0, 1, //Outer lines
|
||||
1, 2,
|
||||
2, 3,
|
||||
3, 7,
|
||||
7, 11,
|
||||
11, 15,
|
||||
15, 14,
|
||||
14, 13,
|
||||
13, 12,
|
||||
12, 8,
|
||||
8, 4,
|
||||
4, 0,
|
||||
|
||||
//Inner lines
|
||||
5, 6,
|
||||
6, 10,
|
||||
10, 9,
|
||||
9, 5,
|
||||
|
||||
//TL edge lines
|
||||
1, 5,
|
||||
4, 5,
|
||||
|
||||
//TR edge lines
|
||||
2, 6,
|
||||
6, 7,
|
||||
|
||||
//BL edge lines
|
||||
8, 9,
|
||||
9, 13,
|
||||
|
||||
//BR edge lines
|
||||
10, 14,
|
||||
10, 11
|
||||
};
|
||||
|
||||
vertex SolidColorVertex vertex_lines(
|
||||
const device unsigned* indicesBuffer [[buffer(INDICES_BUFFER_INDEX)]],
|
||||
const device OsdPerPatchVertexBezier* osdPerPatchVertexBezier [[buffer(OSD_PERPATCHVERTEX_BUFFER_INDEX)]],
|
||||
const constant PerFrameConstants& frameConsts [[buffer(FRAME_CONST_BUFFER_INDEX)]],
|
||||
uint vertex_id [[vertex_id]]
|
||||
)
|
||||
{
|
||||
const auto idx_size = sizeof(BSplineControlLineIndices) / sizeof(BSplineControlLineIndices[0]);
|
||||
const auto idx = vertex_id % idx_size;
|
||||
const auto patch_id = vertex_id / idx_size;
|
||||
|
||||
const auto in = osdPerPatchVertexBezier[patch_id * VERTEX_CONTROL_POINTS_PER_PATCH + BSplineControlLineIndices[idx]];
|
||||
|
||||
SolidColorVertex out;
|
||||
|
||||
out.positionOut = frameConsts.ModelViewProjectionMatrix * float4(in.P, 1.0);
|
||||
out.positionOut.z -= 0.001;
|
||||
|
||||
if(idx > 22) {
|
||||
out.setColor(half4(0,1,0,1));
|
||||
}
|
||||
else
|
||||
{
|
||||
out.setColor(half4(1,0,0,1));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OSD_PATCH_GREGORY_BASIS || OSD_PATCH_GREGORY || OSD_PATCH_GREGORY_BOUNDARY
|
||||
const constant uint GregoryBasisControlLineIndices[] = {
|
||||
//Outer Edge
|
||||
0, 2,
|
||||
2, 16,
|
||||
16, 15,
|
||||
15, 17,
|
||||
17, 11,
|
||||
11, 10,
|
||||
10, 12,
|
||||
12, 6,
|
||||
6, 5,
|
||||
5, 7,
|
||||
7, 1,
|
||||
1, 0,
|
||||
|
||||
//Outside-Inside Edges
|
||||
1, 3,
|
||||
2, 4,
|
||||
16, 18,
|
||||
17, 19,
|
||||
11, 13,
|
||||
12, 14,
|
||||
6, 8,
|
||||
7, 9,
|
||||
|
||||
//Inner Edge
|
||||
3, 4,
|
||||
4, 18,
|
||||
18, 19,
|
||||
19, 13,
|
||||
13, 14,
|
||||
14, 8,
|
||||
8, 9,
|
||||
9, 3,
|
||||
};
|
||||
|
||||
|
||||
vertex SolidColorVertex vertex_lines(
|
||||
#ifdef OSD_PATCH_GREGORY_BASIS
|
||||
const device unsigned* indicesBuffer [[buffer(INDICES_BUFFER_INDEX)]],
|
||||
const device PackedInputVertex* vertexBuffer [[buffer(VERTEX_BUFFER_INDEX)]],
|
||||
#else
|
||||
const device PackedInputVertex* vertexBuffer [[buffer(OSD_PERPATCHVERTEX_BUFFER_INDEX)]],
|
||||
#endif
|
||||
const constant PerFrameConstants& frameConsts [[buffer(FRAME_CONST_BUFFER_INDEX)]],
|
||||
uint vertex_id [[vertex_id]]
|
||||
)
|
||||
{
|
||||
const auto idx_size = sizeof(GregoryBasisControlLineIndices) / sizeof(GregoryBasisControlLineIndices[0]);
|
||||
const auto idx = vertex_id % idx_size;
|
||||
const auto patch_id = vertex_id / idx_size;
|
||||
|
||||
#ifdef OSD_PATCH_GREGORY_BASIS
|
||||
const auto in = vertexBuffer[indicesBuffer[patch_id * VERTEX_CONTROL_POINTS_PER_PATCH + GregoryBasisControlLineIndices[idx]]];
|
||||
#else
|
||||
const auto in = vertexBuffer[patch_id * 20 + GregoryBasisControlLineIndices[idx]];
|
||||
#endif
|
||||
SolidColorVertex out;
|
||||
|
||||
out.positionOut = frameConsts.ModelViewProjectionMatrix * float4(in.position, 1.0);
|
||||
out.positionOut.z -= 0.001;
|
||||
|
||||
if(idx > 22) {
|
||||
out.setColor(half4(0,1,0,1));
|
||||
}
|
||||
else
|
||||
{
|
||||
out.setColor(half4(1,0,0,1));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OSD_PATCH_QUADS || OSD_PATCH_TRIANGLES
|
||||
|
||||
#if OSD_PATCH_QUADS
|
||||
const constant uint triangleIdx[6] = {
|
||||
0, 2, 1, 3, 2, 0
|
||||
};
|
||||
#endif
|
||||
|
||||
vertex OutputVertex vertex_main(
|
||||
device unsigned* indicesBuffer [[buffer(INDICES_BUFFER_INDEX)]],
|
||||
device PackedInputVertex* vertexBuffer [[buffer(VERTEX_BUFFER_INDEX)]],
|
||||
const constant PerFrameConstants& frameConsts [[buffer(FRAME_CONST_BUFFER_INDEX)]],
|
||||
const device float2* osdFaceVaryingData[[buffer(OSD_FVAR_DATA_BUFFER_INDEX)]],
|
||||
const device int* osdFaceVaryingIndices[[buffer(OSD_FVAR_INDICES_BUFFER_INDEX)]],
|
||||
uint vertex_id [[vertex_id]]
|
||||
)
|
||||
{
|
||||
#if OSD_PATCH_QUADS
|
||||
const auto quadId = vertex_id / 6;
|
||||
#else
|
||||
const auto primID = vertex_id / 3;
|
||||
#endif
|
||||
|
||||
#if OSD_PATCH_QUADS
|
||||
float3 p0 = vertexBuffer[indicesBuffer[quadId * 4 + 0]].position;
|
||||
float3 p1 = vertexBuffer[indicesBuffer[quadId * 4 + 1]].position;
|
||||
float3 p2 = vertexBuffer[indicesBuffer[quadId * 4 + 2]].position;
|
||||
float3 position = vertexBuffer[indicesBuffer[quadId * 4 + triangleIdx[vertex_id % 6]]].position;
|
||||
float2 uv = osdFaceVaryingData[osdFaceVaryingIndices[quadId * 4 + triangleIdx[vertex_id % 6]]].xy;
|
||||
#else
|
||||
float3 p0 = vertexBuffer[indicesBuffer[primID * 3 + 0]].position;
|
||||
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;
|
||||
#endif
|
||||
|
||||
float3 normal = normalize(cross(p2 - p1, p0 - p1));
|
||||
|
||||
|
||||
OutputVertex out;
|
||||
out.position = (frameConsts.ModelViewMatrix * float4(position, 1.0)).xyz;
|
||||
out.positionOut = frameConsts.ModelViewProjectionMatrix * float4(position, 1.0);
|
||||
out.normal = (frameConsts.ModelViewMatrix * float4(normal, 0.0)).xyz;
|
||||
|
||||
#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_COLOR
|
||||
out.patchColor.rg = uv;
|
||||
#endif
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
vertex SolidColorVertex vertex_lines(
|
||||
device unsigned* indicesBuffer [[buffer(INDICES_BUFFER_INDEX)]],
|
||||
device PackedInputVertex* vertexBuffer [[buffer(VERTEX_BUFFER_INDEX)]],
|
||||
const constant PerFrameConstants& frameConsts [[buffer(FRAME_CONST_BUFFER_INDEX)]],
|
||||
uint vertex_id [[vertex_id]]
|
||||
)
|
||||
{
|
||||
#if OSD_PATCH_QUADS
|
||||
const auto quadId = vertex_id / 6;
|
||||
#else
|
||||
const auto primID = vertex_id / 3;
|
||||
#endif
|
||||
|
||||
#if OSD_PATCH_QUADS
|
||||
float3 position = vertexBuffer[indicesBuffer[quadId * 4 + triangleIdx[vertex_id % 6]]].position;
|
||||
#else
|
||||
float3 position = vertexBuffer[indicesBuffer[vertex_id]].position;
|
||||
#endif
|
||||
|
||||
SolidColorVertex out;
|
||||
out.positionOut = frameConsts.ModelViewProjectionMatrix * float4(position, 1.0);
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
fragment half4 fragment_solidcolor(SolidColorVertex in [[stage_in]])
|
||||
{
|
||||
return in.getColor();
|
||||
}
|
||||
|
||||
|
||||
fragment float4 fragment_main(OutputVertex in [[stage_in]],
|
||||
const constant Light* lightData [[buffer(0)]],
|
||||
const constant PerFrameConstants& frameConsts [[buffer(1)]],
|
||||
const constant float4& shade [[buffer(2)]])
|
||||
{
|
||||
float4 color;
|
||||
|
||||
#if SHADING_TYPE == SHADING_TYPE_MATERIAL
|
||||
const float3 diffuseColor = float3(0.4f, 0.4f, 0.8f);
|
||||
#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_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);
|
||||
color.xyz = pow(color.xyz, 1/2.2);
|
||||
#else
|
||||
color.xyz = lighting(diffuseColor, lightData, in.position, normalize(in.normal));
|
||||
#endif
|
||||
color.w = 1;
|
||||
return max(color,shade);
|
||||
}
|
||||
1474
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/mtlViewer.mm
vendored
Normal file
1474
blender-5.2.0/extern/opensubdiv-source/examples/mtlViewer/mtlViewer.mm
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user