diff --git a/ios/samples/README.md b/ios/samples/README.md index bbfe218d68..5ea18a2eba 100644 --- a/ios/samples/README.md +++ b/ios/samples/README.md @@ -50,8 +50,11 @@ When building for the simulator, the sample will then link against the libraries ## Xcode Open up one of the Xcode projects: - - hello-triangle/hello-triangle.xcodeproj + - hello-ar/hello-ar.xcodeproj + - hello-gltf/hello-gltf.xcodeproj - hello-pbr/hello-pbr.xcodeproj + - hello-triangle/hello-triangle.xcodeproj + - transparent-rendering/transparent-rendering.xcodeproj Each project contains two schemes, ` Metal` and ` OpenGL`, which use the Metal and OpenGL backends respectively. Before building you will need to select one of the schemes, sign in to diff --git a/ios/samples/app-template.yml b/ios/samples/app-template.yml index 4e27862a89..b79cd2c0dd 100644 --- a/ios/samples/app-template.yml +++ b/ios/samples/app-template.yml @@ -8,6 +8,11 @@ targetTemplates: type: application platform: iOS deploymentTarget: "12.1" + sources: + - path: $target_name + - path: Materials + buildPhase: none + optional: true scheme: configVariants: - Metal diff --git a/ios/samples/hello-ar/hello-ar/Materials/camera_feed.mat b/ios/samples/hello-ar/Materials/camera_feed.mat similarity index 100% rename from ios/samples/hello-ar/hello-ar/Materials/camera_feed.mat rename to ios/samples/hello-ar/Materials/camera_feed.mat diff --git a/ios/samples/hello-ar/hello-ar/Materials/clear_coat.mat b/ios/samples/hello-ar/Materials/clear_coat.mat similarity index 100% rename from ios/samples/hello-ar/hello-ar/Materials/clear_coat.mat rename to ios/samples/hello-ar/Materials/clear_coat.mat diff --git a/ios/samples/hello-ar/build-resources.sh b/ios/samples/hello-ar/build-resources.sh index 206e6b9176..32b0b745db 100755 --- a/ios/samples/hello-ar/build-resources.sh +++ b/ios/samples/hello-ar/build-resources.sh @@ -50,13 +50,13 @@ mkdir -p "${PROJECT_DIR}/generated/" --api all \ --platform mobile \ -o "${PROJECT_DIR}/generated/clear_coat.filamat" \ - "${PROJECT_DIR}/hello-ar/Materials/clear_coat.mat" + "${PROJECT_DIR}/Materials/clear_coat.mat" "${matc_path}" \ --api all \ --platform mobile \ -o "${PROJECT_DIR}/generated/camera_feed.filamat" \ - "${PROJECT_DIR}/hello-ar/Materials/camera_feed.mat" + "${PROJECT_DIR}/Materials/camera_feed.mat" # The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked # into the final binary. It contains all the resources consumed by the app. diff --git a/ios/samples/hello-ar/hello-ar.xcodeproj/project.pbxproj b/ios/samples/hello-ar/hello-ar.xcodeproj/project.pbxproj index c87fad14e9..83a1f220b8 100644 --- a/ios/samples/hello-ar/hello-ar.xcodeproj/project.pbxproj +++ b/ios/samples/hello-ar/hello-ar.xcodeproj/project.pbxproj @@ -13,8 +13,6 @@ 4F8ADB2824BB8FE500EA64C04A6844C4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AE684A73135705C4EDAA7C5366DB6610 /* Assets.xcassets */; }; 67A1C8160381617B0D2860B9B41C531A /* ARKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33B2CBA1A0F654632B39A45DF60AB7C1 /* ARKit.framework */; }; 770B96CD3256BC731F60C78034B791B4 /* FilamentArViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AA47852B486CBD549FA6872916B552EE /* FilamentArViewController.mm */; }; - B3F953D478225239DC20DDC47D10A9A1 /* camera_feed.mat in Resources */ = {isa = PBXBuildFile; fileRef = 8520EB129AB2CFD72015128993FE4505 /* camera_feed.mat */; }; - C0E4DF46746F86DCBA7406E9CFD82EDC /* clear_coat.mat in Resources */ = {isa = PBXBuildFile; fileRef = 240A263072A49523E9ADADCF04DC4DD4 /* clear_coat.mat */; }; C655352AFD3C8571A3B683D550A3C1B5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EC652AC3D2C91759215320C3551D7C99 /* AppDelegate.m */; }; D57ECCB665A104DB0550E0339CE6333D /* FilamentApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CF21F54926F34F027F4FCEA428505A4F /* FilamentApp.cpp */; }; DAC411D895E17D844448ED47563C8618 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C88A8BDFC06D144D80EC052BCCA71983 /* LaunchScreen.storyboard */; }; @@ -24,14 +22,14 @@ /* Begin PBXFileReference section */ 05D9AFA7CFC6498FE2A8C6A53DC9CF3F /* FullScreenTriangle.cpp */ = {isa = PBXFileReference; path = FullScreenTriangle.cpp; sourceTree = ""; }; - 240A263072A49523E9ADADCF04DC4DD4 /* clear_coat.mat */ = {isa = PBXFileReference; path = clear_coat.mat; sourceTree = ""; }; + 2AFEFBF6FE91628599F708178FBB7E32 /* clear_coat.mat */ = {isa = PBXFileReference; path = clear_coat.mat; sourceTree = ""; }; 2AFF66F1228C5F1079042FE2F5FB07DB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 33B2CBA1A0F654632B39A45DF60AB7C1 /* ARKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ARKit.framework; path = System/Library/Frameworks/ARKit.framework; sourceTree = SDKROOT; }; 4F8E6B508F8C5DE284DA2E3453B69144 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53D025A0625708CC50AEA0DBEBB00EE6 /* FilamentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FilamentView.m; sourceTree = ""; }; 5B5D3E611DCDD9CD2C13B825BAD81D8C /* FilamentApp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentApp.h; sourceTree = ""; }; 6938BE21CFB8BEB2422BD49064160490 /* FilamentArViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentArViewController.h; sourceTree = ""; }; - 8520EB129AB2CFD72015128993FE4505 /* camera_feed.mat */ = {isa = PBXFileReference; path = camera_feed.mat; sourceTree = ""; }; + 7C5E322BA97EEB4FB7EC030F252D7D40 /* camera_feed.mat */ = {isa = PBXFileReference; path = camera_feed.mat; sourceTree = ""; }; 973EB840E804440B2AA0F93AF0EE86F4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; A85B9D53F72DEE0374F8EBDF0C9D380D /* FullScreenTriangle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FullScreenTriangle.h; sourceTree = ""; }; AA47852B486CBD549FA6872916B552EE /* FilamentArViewController.mm */ = {isa = PBXFileReference; path = FilamentArViewController.mm; sourceTree = ""; }; @@ -62,16 +60,17 @@ isa = PBXGroup; children = ( 64EC9708BC3BF5967095E27FD13900A5 /* hello-ar */, + 4696851BF71615FF7128AFA5954A65BF /* Materials */, A9AE7CB2486E4723006E178404C8A598 /* Frameworks */, E2EC9706948EC07E74121EF1E7C251E0 /* Products */, ); sourceTree = ""; }; - 5F169D82D2C964B947109934ED064880 /* Materials */ = { + 4696851BF71615FF7128AFA5954A65BF /* Materials */ = { isa = PBXGroup; children = ( - 8520EB129AB2CFD72015128993FE4505 /* camera_feed.mat */, - 240A263072A49523E9ADADCF04DC4DD4 /* clear_coat.mat */, + 7C5E322BA97EEB4FB7EC030F252D7D40 /* camera_feed.mat */, + 2AFEFBF6FE91628599F708178FBB7E32 /* clear_coat.mat */, ); path = Materials; sourceTree = ""; @@ -82,7 +81,6 @@ 2AFF66F1228C5F1079042FE2F5FB07DB /* AppDelegate.h */, EC652AC3D2C91759215320C3551D7C99 /* AppDelegate.m */, C4B733EC024C3C9FDDFAB19F12016B3C /* FilamentArView */, - 5F169D82D2C964B947109934ED064880 /* Materials */, BB5BFAE028DB5F16FB3DEADF38257A53 /* SupportFiles */, ); path = "hello-ar"; @@ -186,8 +184,6 @@ 4F8ADB2824BB8FE500EA64C04A6844C4 /* Assets.xcassets in Resources */, DAC411D895E17D844448ED47563C8618 /* LaunchScreen.storyboard in Resources */, 30B041C9C3658CE4F02EC3A051F172E0 /* Main.storyboard in Resources */, - B3F953D478225239DC20DDC47D10A9A1 /* camera_feed.mat in Resources */, - C0E4DF46746F86DCBA7406E9CFD82EDC /* clear_coat.mat in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -210,7 +206,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#/usr/bin/env/bash\n\nset -e\n\n# Compile resources.\n\n# The hello-ar app requires four resources:\n# 1. The cube mesh\n# 2. The Filament material definition\n# 3. The Filament camera feed material definition\n# 4. The IBL image\n# These will be compiled into the final binary via the resgen tool.\n\nfilamesh_path=\"../../../out/release/filament/bin/filamesh\"\nmatc_path=\"../../../out/release/filament/bin/matc\"\nresgen_path=\"../../../out/release/filament/bin/resgen\"\n\n# Ensure that the required tools are present in the out/ directory.\n# These can be built by running ./build.sh -p desktop -i release at Filament's root directory.\n\nif [[ ! -e \"${filamesh_path}\" ]]; then\n echo \"No filamesh binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${resgen_path}\" ]]; then\n echo \"No resgen binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\n# The filamesh tool converts the .obj file into a Filament-specific filamesh file that has been\n# optimized for loading into Filament.\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${filamesh_path}\" \\\n \"${PROJECT_DIR}/../../../assets/models/cube/cube.obj\" \\\n \"${PROJECT_DIR}/generated/cube.filamesh\"\n\n# The matc tool compiles the clear_coat.mat and camera_feed.mat materials into a Filament material\n# BLOB.\n\n\"${matc_path}\" \\\n --api all \\\n --platform mobile \\\n -o \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/hello-ar/Materials/clear_coat.mat\"\n\n\"${matc_path}\" \\\n --api all \\\n --platform mobile \\\n -o \"${PROJECT_DIR}/generated/camera_feed.filamat\" \\\n \"${PROJECT_DIR}/hello-ar/Materials/camera_feed.mat\"\n\n# The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked\n# into the final binary. It contains all the resources consumed by the app.\n\"${resgen_path}\" \\\n --deploy=\"${PROJECT_DIR}/generated\" \\\n \"${PROJECT_DIR}/generated/cube.filamesh\" \\\n \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/generated/camera_feed.filamat\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_ibl.ktx\"\n\n# FilamentApp.cpp and Resources.S include files generated by resgen.\n# Touch them to force Xcode to recompile.\ntouch \"${PROJECT_DIR}/hello-ar/FilamentArView/FullScreenTriangle.cpp\"\ntouch \"${PROJECT_DIR}/hello-ar/FilamentArView/FilamentApp.cpp\"\ntouch \"${PROJECT_DIR}/hello-ar/SupportFiles/Resources.S\"\n"; + shellScript = "#/usr/bin/env/bash\n\nset -e\n\n# Compile resources.\n\n# The hello-ar app requires four resources:\n# 1. The cube mesh\n# 2. The Filament material definition\n# 3. The Filament camera feed material definition\n# 4. The IBL image\n# These will be compiled into the final binary via the resgen tool.\n\nfilamesh_path=\"../../../out/release/filament/bin/filamesh\"\nmatc_path=\"../../../out/release/filament/bin/matc\"\nresgen_path=\"../../../out/release/filament/bin/resgen\"\n\n# Ensure that the required tools are present in the out/ directory.\n# These can be built by running ./build.sh -p desktop -i release at Filament's root directory.\n\nif [[ ! -e \"${filamesh_path}\" ]]; then\n echo \"No filamesh binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${resgen_path}\" ]]; then\n echo \"No resgen binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\n# The filamesh tool converts the .obj file into a Filament-specific filamesh file that has been\n# optimized for loading into Filament.\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${filamesh_path}\" \\\n \"${PROJECT_DIR}/../../../assets/models/cube/cube.obj\" \\\n \"${PROJECT_DIR}/generated/cube.filamesh\"\n\n# The matc tool compiles the clear_coat.mat and camera_feed.mat materials into a Filament material\n# BLOB.\n\n\"${matc_path}\" \\\n --api all \\\n --platform mobile \\\n -o \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/Materials/clear_coat.mat\"\n\n\"${matc_path}\" \\\n --api all \\\n --platform mobile \\\n -o \"${PROJECT_DIR}/generated/camera_feed.filamat\" \\\n \"${PROJECT_DIR}/Materials/camera_feed.mat\"\n\n# The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked\n# into the final binary. It contains all the resources consumed by the app.\n\"${resgen_path}\" \\\n --deploy=\"${PROJECT_DIR}/generated\" \\\n \"${PROJECT_DIR}/generated/cube.filamesh\" \\\n \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/generated/camera_feed.filamat\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_ibl.ktx\"\n\n# FilamentApp.cpp and Resources.S include files generated by resgen.\n# Touch them to force Xcode to recompile.\ntouch \"${PROJECT_DIR}/hello-ar/FilamentArView/FullScreenTriangle.cpp\"\ntouch \"${PROJECT_DIR}/hello-ar/FilamentArView/FilamentApp.cpp\"\ntouch \"${PROJECT_DIR}/hello-ar/SupportFiles/Resources.S\"\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/samples/hello-ar/project.yml b/ios/samples/hello-ar/project.yml index b4f3eb7951..486ea2b4e0 100644 --- a/ios/samples/hello-ar/project.yml +++ b/ios/samples/hello-ar/project.yml @@ -4,7 +4,6 @@ options: include: ../app-template.yml targets: hello-ar: - sources: hello-ar/ templates: - FilamentApp scheme: diff --git a/ios/samples/hello-gltf/.gitignore b/ios/samples/hello-gltf/.gitignore new file mode 100644 index 0000000000..bb81151f81 --- /dev/null +++ b/ios/samples/hello-gltf/.gitignore @@ -0,0 +1,4 @@ +## User settings +xcuserdata/ +/generated/ + diff --git a/ios/samples/hello-gltf/build-resources.sh b/ios/samples/hello-gltf/build-resources.sh new file mode 100755 index 0000000000..af6e665edc --- /dev/null +++ b/ios/samples/hello-gltf/build-resources.sh @@ -0,0 +1,33 @@ +#/usr/bin/env/bash + +set -e + +# Compile resources. + +# The hello-gltf app requires two resources: +# 1. The IBL image +# 2. The skybox image +# These will be compiled into the final binary via the resgen tool. + +resgen_path="../../../out/release/filament/bin/resgen" + +# Ensure that the required tools are present in the out/ directory. +# These can be built by running ./build.sh -p desktop -i release at Filament's root directory. + +if [[ ! -e "${resgen_path}" ]]; then + echo "No resgen binary could be found in ../../../out/release/filament/bin/." + echo "Ensure Filament has been built/installed before building this app." + exit 1 +fi + +# The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked +# into the final binary. It contains all the resources consumed by the app. +"${resgen_path}" \ + --deploy="${PROJECT_DIR}/generated" \ + "${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_ibl.ktx" \ + "${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_skybox.ktx" + +# App.cpp and Resources.S include files generated by resgen. +# Touch them to force Xcode to recompile. +touch "${PROJECT_DIR}/hello-gltf/FilamentView/App.cpp" +touch "${PROJECT_DIR}/hello-gltf/SupportFiles/Resources.S" diff --git a/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.pbxproj b/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..a5866d84a5 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.pbxproj @@ -0,0 +1,638 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 1137C70E49E7704C40D2FFA9FCAB3DFB /* FilamentApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89DA40747399B13F02116784A3804881 /* FilamentApp.cpp */; }; + 29DBA07A216DA05EBD75955B8579161B /* App.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3AF77884F45974610F79F92F60E904A8 /* App.cpp */; }; + 2BC971729D1F77FDA2244102239C4BF7 /* CameraManipulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6238AED51F5F46CCFBE6892D356D457C /* CameraManipulator.cpp */; }; + 32A5FA52FFDCC30B869907B21CAFC592 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 59032D070D1641AA60F6CC2D2119D7F9 /* Main.storyboard */; }; + 653502530FCA420A8CD7FECC8FDAC2F8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F534BD31E8FB84B3925B0402BFA17214 /* AppDelegate.m */; }; + 818EC58CFCBCFB09887972CD899DEFD8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 47B161015D23D464253ABAF119052C4F /* main.m */; }; + 99620AF86A273BBD9CD12987999C26FD /* DamagedHelmet.glb in Resources */ = {isa = PBXBuildFile; fileRef = B299B19218E1CF7B2D13ABB8ABAF2009 /* DamagedHelmet.glb */; }; + C4AB67A4CDD020573710FAAEBA275609 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3F8FDA2F8F0B257A1364E302157B220A /* Assets.xcassets */; }; + CB9BD467EDE891C189AB4D660E2B5B9E /* FilamentViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4544E7FD3EC9BC5C5E4487B731D42B4E /* FilamentViewController.mm */; }; + E2D98B5F98D4D34F53FA4CAB95DDE467 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FEA341C442B210CFD35E466361EFABCE /* LaunchScreen.storyboard */; }; + EC80D62EC06655C23D67190CEB453E0F /* Resources.S in Sources */ = {isa = PBXBuildFile; fileRef = B1B470F3CDEE0D4A60B11C721201C160 /* Resources.S */; }; + F9C81136BF68753BF8B18FADC3BCE4B6 /* FilamentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D7269DBC8441140F7F89051274495A /* FilamentView.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 07D735319AF2DC69DB8981FEA8B0791E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 0AF0F63216DE40C526ABFABF57BA198D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 31A71C869E24044EA5F802D5B1931BD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 3259514676E5E799670D0F867723B263 /* CameraManipulator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CameraManipulator.h; sourceTree = ""; }; + 3AF77884F45974610F79F92F60E904A8 /* App.cpp */ = {isa = PBXFileReference; path = App.cpp; sourceTree = ""; }; + 3F8FDA2F8F0B257A1364E302157B220A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 4544E7FD3EC9BC5C5E4487B731D42B4E /* FilamentViewController.mm */ = {isa = PBXFileReference; path = FilamentViewController.mm; sourceTree = ""; }; + 47B161015D23D464253ABAF119052C4F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 6238AED51F5F46CCFBE6892D356D457C /* CameraManipulator.cpp */ = {isa = PBXFileReference; path = CameraManipulator.cpp; sourceTree = ""; }; + 84D7269DBC8441140F7F89051274495A /* FilamentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FilamentView.m; sourceTree = ""; }; + 89DA40747399B13F02116784A3804881 /* FilamentApp.cpp */ = {isa = PBXFileReference; path = FilamentApp.cpp; sourceTree = ""; }; + A37B936423E3B1BF1CA137E0AC1ABBCF /* hello-gltf.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "hello-gltf.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + A52D063A6C24A885D52E2F79A44646DA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B1B470F3CDEE0D4A60B11C721201C160 /* Resources.S */ = {isa = PBXFileReference; path = Resources.S; sourceTree = ""; }; + B299B19218E1CF7B2D13ABB8ABAF2009 /* DamagedHelmet.glb */ = {isa = PBXFileReference; path = DamagedHelmet.glb; sourceTree = ""; }; + BAEAC7786B3EA7E47855A56B9D83BC15 /* FilamentViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentViewController.h; sourceTree = ""; }; + D3A6F9906B0647549CF53196820A456B /* FilamentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentView.h; sourceTree = ""; }; + EC3FAC405D5790391F3AE4FBABECB9CE /* App.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = App.h; sourceTree = ""; }; + F534BD31E8FB84B3925B0402BFA17214 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + 213197BBE06FB8316C6A730F99E884AC /* DamagedHelmet */ = { + isa = PBXGroup; + children = ( + B299B19218E1CF7B2D13ABB8ABAF2009 /* DamagedHelmet.glb */, + ); + name = DamagedHelmet; + path = ../../../third_party/models/DamagedHelmet; + sourceTree = ""; + }; + 74FBC1573C79190CC198A0308FB40050 = { + isa = PBXGroup; + children = ( + 213197BBE06FB8316C6A730F99E884AC /* DamagedHelmet */, + A57096EADC8A05A97A275513964A3F88 /* hello-gltf */, + E24AFBD404D0689AD84371D612E5035A /* Products */, + ); + sourceTree = ""; + }; + A57096EADC8A05A97A275513964A3F88 /* hello-gltf */ = { + isa = PBXGroup; + children = ( + 0AF0F63216DE40C526ABFABF57BA198D /* AppDelegate.h */, + F534BD31E8FB84B3925B0402BFA17214 /* AppDelegate.m */, + 6238AED51F5F46CCFBE6892D356D457C /* CameraManipulator.cpp */, + 3259514676E5E799670D0F867723B263 /* CameraManipulator.h */, + D192952467BDC89262858B1E59BF69E1 /* FilamentView */, + AB372FE319A13B1FD8573A52016C270B /* SupportFiles */, + ); + path = "hello-gltf"; + sourceTree = ""; + }; + AB372FE319A13B1FD8573A52016C270B /* SupportFiles */ = { + isa = PBXGroup; + children = ( + 3F8FDA2F8F0B257A1364E302157B220A /* Assets.xcassets */, + A52D063A6C24A885D52E2F79A44646DA /* Info.plist */, + FEA341C442B210CFD35E466361EFABCE /* LaunchScreen.storyboard */, + 47B161015D23D464253ABAF119052C4F /* main.m */, + 59032D070D1641AA60F6CC2D2119D7F9 /* Main.storyboard */, + B1B470F3CDEE0D4A60B11C721201C160 /* Resources.S */, + ); + path = SupportFiles; + sourceTree = ""; + }; + D192952467BDC89262858B1E59BF69E1 /* FilamentView */ = { + isa = PBXGroup; + children = ( + 3AF77884F45974610F79F92F60E904A8 /* App.cpp */, + EC3FAC405D5790391F3AE4FBABECB9CE /* App.h */, + 89DA40747399B13F02116784A3804881 /* FilamentApp.cpp */, + D3A6F9906B0647549CF53196820A456B /* FilamentView.h */, + 84D7269DBC8441140F7F89051274495A /* FilamentView.m */, + BAEAC7786B3EA7E47855A56B9D83BC15 /* FilamentViewController.h */, + 4544E7FD3EC9BC5C5E4487B731D42B4E /* FilamentViewController.mm */, + ); + path = FilamentView; + sourceTree = ""; + }; + E24AFBD404D0689AD84371D612E5035A /* Products */ = { + isa = PBXGroup; + children = ( + A37B936423E3B1BF1CA137E0AC1ABBCF /* hello-gltf.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + BDE1BF085B3CF7972F0866814CF93465 /* hello-gltf */ = { + isa = PBXNativeTarget; + buildConfigurationList = B4AB9DA259CE43EB677725C9E8355571 /* Build configuration list for PBXNativeTarget "hello-gltf" */; + buildPhases = ( + 434C630C7F01B07ABD7545B4B27CEB1C /* Build Resources */, + 30FFFB72D409D092136A7E0935462811 /* Sources */, + 143100B2FF97ACD9B03A078A47392383 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "hello-gltf"; + productName = "hello-gltf"; + productReference = A37B936423E3B1BF1CA137E0AC1ABBCF /* hello-gltf.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 690D846B2164EA54ABAD02A48744C966 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1000; + }; + buildConfigurationList = C7514DDCFDA3C5F803E239F91465CEC7 /* Build configuration list for PBXProject "hello-gltf" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + ); + mainGroup = 74FBC1573C79190CC198A0308FB40050; + projectDirPath = ""; + projectRoot = ""; + targets = ( + BDE1BF085B3CF7972F0866814CF93465 /* hello-gltf */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 143100B2FF97ACD9B03A078A47392383 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C4AB67A4CDD020573710FAAEBA275609 /* Assets.xcassets in Resources */, + 99620AF86A273BBD9CD12987999C26FD /* DamagedHelmet.glb in Resources */, + E2D98B5F98D4D34F53FA4CAB95DDE467 /* LaunchScreen.storyboard in Resources */, + 32A5FA52FFDCC30B869907B21CAFC592 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 434C630C7F01B07ABD7545B4B27CEB1C /* Build Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Build Resources"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#/usr/bin/env/bash\n\nset -e\n\n# Compile resources.\n\n# The hello-gltf app requires two resources:\n# 1. The IBL image\n# 2. The skybox image\n# These will be compiled into the final binary via the resgen tool.\n\nresgen_path=\"../../../out/release/filament/bin/resgen\"\n\n# Ensure that the required tools are present in the out/ directory.\n# These can be built by running ./build.sh -p desktop -i release at Filament's root directory.\n\nif [[ ! -e \"${resgen_path}\" ]]; then\n echo \"No resgen binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\n# The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked\n# into the final binary. It contains all the resources consumed by the app.\n\"${resgen_path}\" \\\n --deploy=\"${PROJECT_DIR}/generated\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_ibl.ktx\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_skybox.ktx\"\n\n# App.cpp and Resources.S include files generated by resgen.\n# Touch them to force Xcode to recompile.\ntouch \"${PROJECT_DIR}/hello-gltf/FilamentView/App.cpp\"\ntouch \"${PROJECT_DIR}/hello-gltf/SupportFiles/Resources.S\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 30FFFB72D409D092136A7E0935462811 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 29DBA07A216DA05EBD75955B8579161B /* App.cpp in Sources */, + 653502530FCA420A8CD7FECC8FDAC2F8 /* AppDelegate.m in Sources */, + 2BC971729D1F77FDA2244102239C4BF7 /* CameraManipulator.cpp in Sources */, + 1137C70E49E7704C40D2FFA9FCAB3DFB /* FilamentApp.cpp in Sources */, + F9C81136BF68753BF8B18FADC3BCE4B6 /* FilamentView.m in Sources */, + CB9BD467EDE891C189AB4D660E2B5B9E /* FilamentViewController.mm in Sources */, + EC80D62EC06655C23D67190CEB453E0F /* Resources.S in Sources */, + 818EC58CFCBCFB09887972CD899DEFD8 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 59032D070D1641AA60F6CC2D2119D7F9 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 07D735319AF2DC69DB8981FEA8B0791E /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + FEA341C442B210CFD35E466361EFABCE /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 31A71C869E24044EA5F802D5B1931BD3 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 161A6B16FC9965670B83726EC49D80CD /* Metal Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + }; + name = "Metal Debug"; + }; + 27C4D8D0780B95190F6A4D3C49DFD25F /* OpenGL Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + ENABLE_BITCODE = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "FILAMENT_APP_USE_OPENGL=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + "../../../out/ios-release/filament/include", + generated, + ); + INFOPLIST_FILE = "hello-gltf/SupportFiles/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "../../../out/ios-release/filament/lib/$(CURRENT_ARCH)", + ); + OTHER_LDFLAGS = ( + "-lfilament", + "-lbackend", + "-lfilaflat", + "-lfilabridge", + "-lutils", + "-lsmol-v", + "-lgeometry", + "-lgltfio_core", + "-lgltfio_resources", + "-limage", + "-lgeometry", + ); + PRODUCT_BUNDLE_IDENTIFIER = "google.filament.hello-gltf"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "OpenGL Release"; + }; + 509C947919BED377E97944A3AF57ACFF /* OpenGL Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + ENABLE_BITCODE = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "FILAMENT_APP_USE_OPENGL=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + "../../../out/ios-debug/filament/include", + generated, + ); + INFOPLIST_FILE = "hello-gltf/SupportFiles/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "../../../out/ios-debug/filament/lib/$(CURRENT_ARCH)", + ); + OTHER_LDFLAGS = ( + "-lfilament", + "-lbackend", + "-lfilaflat", + "-lfilabridge", + "-lutils", + "-lsmol-v", + "-lgeometry", + "-lgltfio_core", + "-lgltfio_resources", + "-limage", + "-lgeometry", + ); + PRODUCT_BUNDLE_IDENTIFIER = "google.filament.hello-gltf"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "OpenGL Debug"; + }; + 72A5169BBB2C5E7E023552905B42D2C9 /* OpenGL Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + }; + name = "OpenGL Debug"; + }; + 895443529C80ABBB9B75881FEAFDE850 /* Metal Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; + VALIDATE_PRODUCT = YES; + }; + name = "Metal Release"; + }; + 98EF694A111236D70B23EDE5D84A4EFC /* OpenGL Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; + VALIDATE_PRODUCT = YES; + }; + name = "OpenGL Release"; + }; + C5157048F1B290D39761ED4F4930FA18 /* Metal Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + ENABLE_BITCODE = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "FILAMENT_APP_USE_METAL=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + "../../../out/ios-release/filament/include", + generated, + ); + INFOPLIST_FILE = "hello-gltf/SupportFiles/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "../../../out/ios-release/filament/lib/$(CURRENT_ARCH)", + ); + OTHER_LDFLAGS = ( + "-lfilament", + "-lbackend", + "-lfilaflat", + "-lfilabridge", + "-lutils", + "-lsmol-v", + "-lgeometry", + "-lgltfio_core", + "-lgltfio_resources", + "-limage", + "-lgeometry", + ); + PRODUCT_BUNDLE_IDENTIFIER = "google.filament.hello-gltf"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Metal Release"; + }; + E31F4FA2C21C14838BEB5751F340DAC8 /* Metal Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + ENABLE_BITCODE = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "FILAMENT_APP_USE_METAL=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + "../../../out/ios-debug/filament/include", + generated, + ); + INFOPLIST_FILE = "hello-gltf/SupportFiles/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "../../../out/ios-debug/filament/lib/$(CURRENT_ARCH)", + ); + OTHER_LDFLAGS = ( + "-lfilament", + "-lbackend", + "-lfilaflat", + "-lfilabridge", + "-lutils", + "-lsmol-v", + "-lgeometry", + "-lgltfio_core", + "-lgltfio_resources", + "-limage", + "-lgeometry", + ); + PRODUCT_BUNDLE_IDENTIFIER = "google.filament.hello-gltf"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Metal Debug"; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B4AB9DA259CE43EB677725C9E8355571 /* Build configuration list for PBXNativeTarget "hello-gltf" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E31F4FA2C21C14838BEB5751F340DAC8 /* Metal Debug */, + C5157048F1B290D39761ED4F4930FA18 /* Metal Release */, + 509C947919BED377E97944A3AF57ACFF /* OpenGL Debug */, + 27C4D8D0780B95190F6A4D3C49DFD25F /* OpenGL Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ""; + }; + C7514DDCFDA3C5F803E239F91465CEC7 /* Build configuration list for PBXProject "hello-gltf" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 161A6B16FC9965670B83726EC49D80CD /* Metal Debug */, + 895443529C80ABBB9B75881FEAFDE850 /* Metal Release */, + 72A5169BBB2C5E7E023552905B42D2C9 /* OpenGL Debug */, + 98EF694A111236D70B23EDE5D84A4EFC /* OpenGL Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = "Metal Debug"; + }; +/* End XCConfigurationList section */ + }; + rootObject = 690D846B2164EA54ABAD02A48744C966 /* Project object */; +} diff --git a/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..919434a625 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/samples/hello-gltf/hello-gltf.xcodeproj/xcshareddata/xcschemes/hello-gltf Metal.xcscheme b/ios/samples/hello-gltf/hello-gltf.xcodeproj/xcshareddata/xcschemes/hello-gltf Metal.xcscheme new file mode 100644 index 0000000000..81f23baf21 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf.xcodeproj/xcshareddata/xcschemes/hello-gltf Metal.xcscheme @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/samples/hello-gltf/hello-gltf.xcodeproj/xcshareddata/xcschemes/hello-gltf OpenGL.xcscheme b/ios/samples/hello-gltf/hello-gltf.xcodeproj/xcshareddata/xcschemes/hello-gltf OpenGL.xcscheme new file mode 100644 index 0000000000..aefb6d95f5 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf.xcodeproj/xcshareddata/xcschemes/hello-gltf OpenGL.xcscheme @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/samples/hello-gltf/hello-gltf/AppDelegate.h b/ios/samples/hello-gltf/hello-gltf/AppDelegate.h new file mode 100644 index 0000000000..6f34e3baa2 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/AppDelegate.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow* window; + +@end diff --git a/ios/samples/hello-gltf/hello-gltf/AppDelegate.m b/ios/samples/hello-gltf/hello-gltf/AppDelegate.m new file mode 100644 index 0000000000..a4e4e576ce --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/AppDelegate.m @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +@end diff --git a/ios/samples/hello-gltf/hello-gltf/CameraManipulator.cpp b/ios/samples/hello-gltf/hello-gltf/CameraManipulator.cpp new file mode 100644 index 0000000000..9386134c5b --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/CameraManipulator.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "CameraManipulator.h" + +using namespace filament::math; + +template +static constexpr inline double radians(T deg) { + return deg * (M_PI / 180.0); +} + +static inline double3 rotateVector(double rx, double ry, const double3& v) { + return (mat3::rotation(ry, double3{ 0, 1, 0}) * mat3::rotation(rx, double3{ 1, 0, 0})) * v; +} + +//------------------------------------------------------------------------------ + +CameraManipulator::CameraManipulator() = default; + +CameraManipulator::CameraManipulator(Camera* camera, size_t width, size_t height) + : mCamera(camera), mWidth(width), mHeight(height), mAspect(double(width)/height) { + lookAt(double3(0), double3(0,0,-1)); +} + +void CameraManipulator::setCamera(Camera* camera) { + mCamera = camera; +} + +void CameraManipulator::setViewport(size_t w, size_t h) { + mWidth = w; + mHeight = h; + mAspect = double(w)/h; +} + +//------------------------------------------------------------------------------ +void CameraManipulator::lookAt(const double3& eye, const double3& at) { + mTranslation = eye; + double3 dt = at - eye; + double yz_length = std::sqrt((dt.y * dt.y) + (dt.z * dt.z)); + mRotation.z = 0.0; + mRotation.x = std::atan2(dt.y, -dt.z); + mRotation.y = std::atan2(dt.x, yz_length); + mCenterOfInterest = -length(dt); + updateCameraTransform(); +} + +//------------------------------------------------------------------------------ +void CameraManipulator::track(const double2& delta) { + + double3 d_s = rotateVector(mRotation.x, mRotation.y, { 1.0, 0.0, 0.0}); + double3 d_t = rotateVector(mRotation.x, mRotation.y, { 0.0, 1.0, 0.0}); + + double mult_t = 2.0 * mCenterOfInterest * std::tan(radians(mFovx) / 2.0); + double mult_s = mult_t / mWidth; + mult_t /= mHeight; + + double s = mult_s * delta.x; + double t = mult_t * delta.y; + + mTranslation += (s * d_s) + (t * d_t); + updateCameraTransform(); +} + +//------------------------------------------------------------------------------ +void CameraManipulator::dolly(double delta, double dolly_speed) { + double3 eye = mTranslation; + double3 v = rotateVector(mRotation.x, mRotation.y, { 0.0, 0.0, mCenterOfInterest}); + double3 view = eye + v; + + // Magic dolly function + v = normalize(v); + double t = delta / mWidth; + double dolly_by = 1.0 - std::exp(-dolly_speed * t); + + dolly_by *= mCenterOfInterest; + double3 new_eye = eye + (dolly_by * v); + + mTranslation = new_eye; + v = new_eye - view; + mCenterOfInterest = -length(v); + updateCameraTransform(); +} + +void CameraManipulator::rotate(const double2& delta, double rotate_speed) { + double rot_x = mRotation.x; + double rot_y = mRotation.y; + double rot_z = mRotation.z; + double3 eye = mTranslation; + + double3 view = eye + rotateVector(rot_x, rot_y, { 0.0, 0.0, mCenterOfInterest}); + + rot_y += rotate_speed * (-delta.x / mWidth); + rot_x += rotate_speed * ( delta.y / mHeight); + + mTranslation = view + rotateVector(rot_x, rot_y, {0.0, 0.0, -mCenterOfInterest}); + mRotation = double3(rot_x, rot_y, rot_z); + updateCameraTransform(); +} + +void CameraManipulator::updateCameraTransform() { + if (mCamera) { + mat4 rotate_z = mat4::rotation(mRotation.z, double3(0, 0, 1)); + mat4 rotate_x = mat4::rotation(mRotation.x, double3(1, 0, 0)); + mat4 rotate_y = mat4::rotation(mRotation.y, double3(0, 1, 0)); + mat4 translate = mat4::translation(mTranslation); + mat4 view = translate * (rotate_y * rotate_x * rotate_z); + mCamera->setModelMatrix(mat4f(view)); + if (mCameraChanged) { + mCameraChanged(mCamera); + } + } +} + +void CameraManipulator::updateCameraProjection() { + if (mCamera) { + mCamera->setProjection(mFovx, mAspect, mClipNear, mClipFar); + if (mCameraChanged) { + mCameraChanged(mCamera); + } + } +} + +void CameraManipulator::setCameraChangedCallback(CameraManipulator::CameraChangedCallback cb) { + mCameraChanged = cb; +} diff --git a/ios/samples/hello-gltf/hello-gltf/CameraManipulator.h b/ios/samples/hello-gltf/hello-gltf/CameraManipulator.h new file mode 100644 index 0000000000..1eba71f247 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/CameraManipulator.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TNT_FILAMENT_SAMPLE_CAMERA_MANIPULATOR_H +#define TNT_FILAMENT_SAMPLE_CAMERA_MANIPULATOR_H + +#include +#include +#include +#include + +#include + +class CameraManipulator { +public: + using Camera = filament::Camera; + using CameraChangedCallback = std::function; + + CameraManipulator(); + CameraManipulator(Camera* camera, size_t width, size_t height); + + void setCameraChangedCallback(CameraChangedCallback cb); + + void setCamera(Camera* camera); + Camera const* getCamera() const { + return mCamera; + } + + void setViewport(size_t w, size_t h); + + void lookAt(const filament::math::double3& eye, const filament::math::double3& at); + void track(const filament::math::double2& delta); + void dolly(double delta, double dollySpeed = 5.0); + void rotate(const filament::math::double2& delta, double rotateSpeed = 7.0); + + void updateCameraTransform(); + +private: + void updateCameraProjection(); + + Camera* mCamera = nullptr; + + filament::math::double3 mRotation; + filament::math::double3 mTranslation; + + double mCenterOfInterest = 10.0; + double mFovx = 65.0; + double mClipNear = 0.1; + double mClipFar = 11.0; + size_t mWidth; + size_t mHeight; + double mAspect = 1.0f; + + std::function mCameraChanged; +}; + +#endif // TNT_FILAMENT_SAMPLE_CAMERA_MANIPULATOR_H diff --git a/ios/samples/hello-gltf/hello-gltf/FilamentView/App.cpp b/ios/samples/hello-gltf/hello-gltf/FilamentView/App.cpp new file mode 100644 index 0000000000..51bce9468c --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/FilamentView/App.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "App.h" + +#include +#include + +#include +#include +#include + +#include +#include + +// This file is generated via the "Run Script" build phase and contains the IBL and skybox +// textures this app uses. +#include "resources.h" + +App::App(void* nativeLayer, uint32_t width, uint32_t height, const utils::Path& resourcePath) + : nativeLayer(nativeLayer), width(width), height(height), resourcePath(resourcePath) { + setupFilament(); + setupIbl(); + setupMesh(); + setupView(); +} + +void App::render() { + if (renderer->beginFrame(swapChain)) { + renderer->render(view); + renderer->endFrame(); + } +} + +void App::pan(float deltaX, float deltaY) { + cameraManipulator.rotate(filament::math::double2(deltaX, -deltaY), 10); +} + +App::~App() { + engine->destroy(app.indirectLight); + engine->destroy(app.iblTexture); + engine->destroy(app.skyboxTexture); + engine->destroy(app.skybox); + app.assetLoader->destroyAsset(app.asset); + app.materialProvider->destroyMaterials(); + delete app.materialProvider; + gltfio::AssetLoader::destroy(&app.assetLoader); + + engine->destroy(renderer); + engine->destroy(scene); + engine->destroy(view); + engine->destroy(camera); + engine->destroy(swapChain); + engine->destroy(&engine); +} + +void App::setupFilament() { +#if FILAMENT_APP_USE_OPENGL + engine = Engine::create(filament::Engine::Backend::OPENGL); +#elif FILAMENT_APP_USE_METAL + engine = Engine::create(filament::Engine::Backend::METAL); +#endif + swapChain = engine->createSwapChain(nativeLayer); + renderer = engine->createRenderer(); + scene = engine->createScene(); + camera = engine->createCamera(); + cameraManipulator.setCamera(camera); + cameraManipulator.setViewport(width, height); + cameraManipulator.lookAt(filament::math::double3(0, 0, 3), filament::math::double3(0, 0, 0)); + camera->setProjection(60, (float) width / height, 0.1, 10); +} + +void App::setupIbl() { + image::KtxBundle* iblBundle = new image::KtxBundle(RESOURCES_VENETIAN_CROSSROADS_IBL_DATA, + RESOURCES_VENETIAN_CROSSROADS_IBL_SIZE); + float3 harmonics[9]; + parseSphereHarmonics(iblBundle->getMetadata("sh"), harmonics); + app.iblTexture = image::KtxUtility::createTexture(engine, iblBundle, false, true); + + image::KtxBundle* skyboxBundle = new image::KtxBundle(RESOURCES_VENETIAN_CROSSROADS_SKYBOX_DATA, + RESOURCES_VENETIAN_CROSSROADS_SKYBOX_SIZE); + app.skyboxTexture = image::KtxUtility::createTexture(engine, skyboxBundle, false, true); + + app.skybox = Skybox::Builder() + .environment(app.skyboxTexture) + .build(*engine); + + app.indirectLight = IndirectLight::Builder() + .reflections(app.iblTexture) + .irradiance(3, harmonics) + .intensity(30000) + .build(*engine); + scene->setIndirectLight(app.indirectLight); + scene->setSkybox(app.skybox); + + app.sun = EntityManager::get().create(); + LightManager::Builder(LightManager::Type::SUN) + .castShadows(true) + .direction({0.0, -1.0, 0.0}) + .build(*engine, app.sun); + scene->addEntity(app.sun); +} + +void App::setupMesh() { + app.materialProvider = gltfio::createUbershaderLoader(engine); + app.assetLoader = gltfio::AssetLoader::create({engine, app.materialProvider, nullptr}); + + // Load the glTF file. + std::ifstream in(resourcePath.concat(utils::Path("DamagedHelmet.glb")), std::ifstream::in); + in.seekg(0, std::ios::end); + std::ifstream::pos_type size = in.tellg(); + in.seekg(0); + std::vector buffer(size); + if (!in.read((char*) buffer.data(), size)) { + std::cerr << "Unable to read scene.gltf" << std::endl; + exit(1); + } + app.asset = app.assetLoader->createAssetFromBinary(buffer.data(), static_cast(size)); + + gltfio::ResourceLoader({ + .engine = engine, + .normalizeSkinningWeights = true, + .recomputeBoundingBoxes = false + }).loadResources(app.asset); + + scene->addEntities(app.asset->getEntities(), app.asset->getEntityCount()); +} + +void App::setupView() { + view = engine->createView(); + view->setDepthPrepass(filament::View::DepthPrepass::DISABLED); + view->setScene(scene); + view->setCamera(camera); + view->setViewport(Viewport(0, 0, width, height)); + + // Even FXAA anti-aliasing is overkill on iOS retina screens. This saves a few ms. + view->setAntiAliasing(View::AntiAliasing::NONE); +} + +void App::parseSphereHarmonics(const char* str, float3 harmonics[9]) { + std::istringstream iss(str); + std::string read; + for (int i = 0; i < 9; i++) { + float3 harmonic; + iss >> read; + harmonic.x = std::stof(read); + iss >> read; + harmonic.y = std::stof(read); + iss >> read; + harmonic.z = std::stof(read); + harmonics[i] = std::move(harmonic); + } +} diff --git a/ios/samples/hello-gltf/hello-gltf/FilamentView/App.h b/ios/samples/hello-gltf/hello-gltf/FilamentView/App.h new file mode 100644 index 0000000000..3702df33c1 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/FilamentView/App.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef App_h +#define App_h + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CameraManipulator.h" + +#include + +using namespace filament; +using namespace filament::math; +using utils::Entity; +using utils::EntityManager; + +namespace gltfio { + class AssetLoader; + class MaterialProvider; + class FilamentAsset; +} + +class App { +public: + + App(void* nativeLayer, uint32_t width, uint32_t height, const utils::Path& resourcePath); + ~App(); + App(const App&) = delete; + App& operator=(const App&) = delete; + + void render(); + void pan(float deltaX, float deltaY); + +private: + + void setupFilament(); + void setupIbl(); + void setupMaterial(); + void setupMesh(); + void setupView(); + + static void parseSphereHarmonics(const char* str, float3 harmonics[9]); + + void* nativeLayer = nullptr; + uint32_t width, height; + const utils::Path resourcePath; + + Engine* engine = nullptr; + Renderer* renderer = nullptr; + Scene* scene = nullptr; + View* view = nullptr; + Camera* camera = nullptr; + SwapChain* swapChain = nullptr; + + // App-specific + struct { + IndirectLight* indirectLight = nullptr; + Texture* iblTexture = nullptr; + Texture* skyboxTexture = nullptr; + Skybox* skybox = nullptr; + Entity sun; + + gltfio::AssetLoader* assetLoader; + gltfio::MaterialProvider* materialProvider; + gltfio::FilamentAsset* asset; + } app; + + CameraManipulator cameraManipulator; + +}; + +#endif /* App_h */ diff --git a/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentApp.cpp b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentApp.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentView.h b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentView.h new file mode 100644 index 0000000000..1b3426829e --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentView.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@interface FilamentView : UIView + +@end diff --git a/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentView.m b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentView.m new file mode 100644 index 0000000000..11d66aa179 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentView.m @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FilamentView.h" + +// These defines are set in the "Preprocessor Macros" build setting for each scheme. +#if !FILAMENT_APP_USE_METAL && \ + !FILAMENT_APP_USE_OPENGL +#error A valid FILAMENT_APP_USE_ backend define must be set. +#endif + +#define METAL_AVAILABLE __has_include() + +#if !METAL_AVAILABLE && FILAMENT_APP_USE_METAL +#error The iOS simulator does not support Metal. +#endif + +@implementation FilamentView + +- (instancetype)initWithCoder:(NSCoder*)coder +{ + if (self = [super initWithCoder:coder]) { +#if FILAMENT_APP_USE_OPENGL + [self initializeGLLayer]; +#elif FILAMENT_APP_USE_METAL + [self initializeMetalLayer]; +#endif + self.contentScaleFactor = UIScreen.mainScreen.nativeScale; + } + + return self; +} + +- (void)initializeMetalLayer +{ +#if METAL_AVAILABLE + CAMetalLayer* metalLayer = (CAMetalLayer*) self.layer; + metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; + CGRect nativeBounds = [UIScreen mainScreen].nativeBounds; + metalLayer.drawableSize = nativeBounds.size; + metalLayer.opaque = YES; +#endif +} + +// OpenGL ES was deprecated in iOS 12. Ignore deprecation warnings for CAEAGLLayer. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +- (void)initializeGLLayer +{ + CAEAGLLayer* glLayer = (CAEAGLLayer*) self.layer; + glLayer.opaque = YES; +} + ++ (Class) layerClass +{ +#if FILAMENT_APP_USE_OPENGL + return [CAEAGLLayer class]; +#elif FILAMENT_APP_USE_METAL + return [CAMetalLayer class]; +#endif +} + +@end diff --git a/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentViewController.h b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentViewController.h new file mode 100644 index 0000000000..7dc2e5541b --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentViewController.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@interface FilamentViewController : UIViewController + +@end diff --git a/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentViewController.mm b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentViewController.mm new file mode 100644 index 0000000000..5fc69b9187 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/FilamentView/FilamentViewController.mm @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FilamentViewController.h" + +#import "App.h" + +#define METAL_AVAILABLE __has_include() + +#if !METAL_AVAILABLE +#error The iOS simulator does not support Metal. +#endif + +@interface FilamentViewController () { + App* app; + CADisplayLink* displayLink; + CGPoint previousLocation; + UIPanGestureRecognizer* panRecognizer; +} + +@end + +@implementation FilamentViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + CGRect nativeBounds = [[UIScreen mainScreen] nativeBounds]; + NSString* resourcePath = [NSBundle mainBundle].bundlePath; + app = new App((__bridge void*) self.view.layer, nativeBounds.size.width, + nativeBounds.size.height, utils::Path([resourcePath cStringUsingEncoding:NSUTF8StringEncoding])); + + // Call render 60 times a second. + displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(render)]; + displayLink.preferredFramesPerSecond = 60; + [displayLink addToRunLoop:NSRunLoop.currentRunLoop forMode:NSDefaultRunLoopMode]; + + // Set up a pan gesture recognizer, used to orbit the camera. + panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPan:)]; + panRecognizer.minimumNumberOfTouches = 1; + panRecognizer.maximumNumberOfTouches = 1; + [self.view addGestureRecognizer:panRecognizer]; +} + +- (void)render +{ + app->render(); +} + +- (void)didPan:(UIPanGestureRecognizer*)sender +{ + CGPoint location = [sender locationInView:self.view]; + if (sender.state == UIGestureRecognizerStateBegan) { + previousLocation = location; + return; + } + CGPoint delta = CGPointMake(location.x - previousLocation.x, location.y - previousLocation.y); + previousLocation = location; + app->pan(delta.x, delta.y); +} + +- (void)dealloc +{ + delete app; +} + +@end diff --git a/ios/samples/hello-gltf/hello-gltf/SupportFiles/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..d8db8d65fd --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "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" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "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" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ios/samples/hello-gltf/hello-gltf/SupportFiles/Assets.xcassets/Contents.json b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Assets.xcassets/Contents.json new file mode 100644 index 0000000000..da4a164c91 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ios/samples/hello-gltf/hello-gltf/SupportFiles/Base.lproj/LaunchScreen.storyboard b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000..bfa3612941 --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/samples/hello-gltf/hello-gltf/SupportFiles/Base.lproj/Main.storyboard b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Base.lproj/Main.storyboard new file mode 100644 index 0000000000..201448ea3f --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Base.lproj/Main.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/samples/hello-gltf/hello-gltf/SupportFiles/Info.plist b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Info.plist new file mode 100644 index 0000000000..ceb0d413af --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSCameraUsageDescription + The camera is used to display AR content. + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + + diff --git a/ios/samples/hello-gltf/hello-gltf/SupportFiles/Resources.S b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Resources.S new file mode 100644 index 0000000000..9a0129edbf --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/SupportFiles/Resources.S @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is generated by the "Run Script" phase. +#include "resources.apple.S" diff --git a/ios/samples/hello-gltf/hello-gltf/SupportFiles/main.m b/ios/samples/hello-gltf/hello-gltf/SupportFiles/main.m new file mode 100644 index 0000000000..17d5d56f0f --- /dev/null +++ b/ios/samples/hello-gltf/hello-gltf/SupportFiles/main.m @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/ios/samples/hello-gltf/project.yml b/ios/samples/hello-gltf/project.yml new file mode 100644 index 0000000000..5e76b66b02 --- /dev/null +++ b/ios/samples/hello-gltf/project.yml @@ -0,0 +1,18 @@ +name: hello-gltf +options: + bundleIdPrefix: google.filament +include: ../app-template.yml +targets: + hello-gltf: + sources: hello-gltf/ + sources: + - path: '../../../third_party/models/DamagedHelmet/DamagedHelmet.glb' + buildPhase: resources + templates: + - FilamentApp + settings: + base: + OTHER_LDFLAGS: ["-lgltfio_core", "-lgltfio_resources", "-limage", "-lgeometry"] + preBuildScripts: + - path: build-resources.sh + name: Build Resources diff --git a/ios/samples/hello-pbr/hello-pbr/clear_coat.mat b/ios/samples/hello-pbr/Materials/clear_coat.mat similarity index 100% rename from ios/samples/hello-pbr/hello-pbr/clear_coat.mat rename to ios/samples/hello-pbr/Materials/clear_coat.mat diff --git a/ios/samples/hello-pbr/build-resources.sh b/ios/samples/hello-pbr/build-resources.sh index 0ae5b679b4..500c6038b5 100755 --- a/ios/samples/hello-pbr/build-resources.sh +++ b/ios/samples/hello-pbr/build-resources.sh @@ -48,7 +48,7 @@ mkdir -p "${PROJECT_DIR}/generated/" --api all \ --platform mobile \ -o "${PROJECT_DIR}/generated/clear_coat.filamat" \ - "${PROJECT_DIR}/hello-pbr/clear_coat.mat" + "${PROJECT_DIR}/Materials/clear_coat.mat" # The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked # into the final binary. It contains all the resources consumed by the app. diff --git a/ios/samples/hello-pbr/hello-pbr.xcodeproj/project.pbxproj b/ios/samples/hello-pbr/hello-pbr.xcodeproj/project.pbxproj index 4ef8a6d05f..b4eb9fcc41 100644 --- a/ios/samples/hello-pbr/hello-pbr.xcodeproj/project.pbxproj +++ b/ios/samples/hello-pbr/hello-pbr.xcodeproj/project.pbxproj @@ -10,7 +10,6 @@ 32072E0FA93A0A4EEB06D632927C6438 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DACB12BFCAAA3222E7D1E9BB80475894 /* ViewController.m */; }; 3C183B77078317A8605B572491C58C3A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1CAE8879115ECEC53FA0F052F48A970B /* Assets.xcassets */; }; 5A501B519E880E71BFB22EEA3EA1809F /* Resources.S in Sources */ = {isa = PBXBuildFile; fileRef = AC02B019CB36611A7BCE5773FB111E50 /* Resources.S */; }; - 6AF26A82182F32DB06D1FB51AB97BF1B /* clear_coat.mat in Resources */ = {isa = PBXBuildFile; fileRef = 334B2796A65BE4E8666FCB5070CE0432 /* clear_coat.mat */; }; 76A422929373887929994B3EE3063683 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 45C71AD43B55E58E0724364747DDEF25 /* LaunchScreen.storyboard */; }; 92CA86A4C46EB5F4A45972614C19AC31 /* CameraManipulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D57C53C47A84D05D23B652786E68F509 /* CameraManipulator.cpp */; }; 9FD1994944C09B24149B78889931A474 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE9A0CE98FB055F3478E1CCBC21EE6D /* AppDelegate.m */; }; @@ -23,7 +22,6 @@ /* Begin PBXFileReference section */ 17ADA23252FA61486B05D5BA85F69741 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 1CAE8879115ECEC53FA0F052F48A970B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 334B2796A65BE4E8666FCB5070CE0432 /* clear_coat.mat */ = {isa = PBXFileReference; path = clear_coat.mat; sourceTree = ""; }; 37CB2FCA6711AE57BD4B39F754C8F69D /* hello-pbr.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "hello-pbr.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 42B9073CE652C53E7F0A460285BB977D /* FilamentView.mm */ = {isa = PBXFileReference; path = FilamentView.mm; sourceTree = ""; }; 4618C7511DE661F89B1147340F67BE11 /* FilamentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentView.h; sourceTree = ""; }; @@ -32,6 +30,7 @@ A17327655C031D575A522AD1F9C196E8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; A3680F594905261290AEDB79A15F7AB2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; AC02B019CB36611A7BCE5773FB111E50 /* Resources.S */ = {isa = PBXFileReference; path = Resources.S; sourceTree = ""; }; + ADF252527D202BB9D53E29C86DEEB0F3 /* clear_coat.mat */ = {isa = PBXFileReference; path = clear_coat.mat; sourceTree = ""; }; B35CDFC5B6E5142B5E57BE33045B4415 /* FilamentApp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentApp.h; sourceTree = ""; }; D57C53C47A84D05D23B652786E68F509 /* CameraManipulator.cpp */ = {isa = PBXFileReference; path = CameraManipulator.cpp; sourceTree = ""; }; DACB12BFCAAA3222E7D1E9BB80475894 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; @@ -50,7 +49,6 @@ 1CAE8879115ECEC53FA0F052F48A970B /* Assets.xcassets */, D57C53C47A84D05D23B652786E68F509 /* CameraManipulator.cpp */, E176563EAAB0B36EFA7D67FD93FFC7A9 /* CameraManipulator.h */, - 334B2796A65BE4E8666FCB5070CE0432 /* clear_coat.mat */, F01D34676A81F3F367B9F6AFFA54E12A /* FilamentApp.cpp */, B35CDFC5B6E5142B5E57BE33045B4415 /* FilamentApp.h */, 4618C7511DE661F89B1147340F67BE11 /* FilamentView.h */, @@ -70,6 +68,7 @@ isa = PBXGroup; children = ( 4A44033C70281A0FC58A64FE24F43E4F /* hello-pbr */, + D92946BE29B34E951A7E0714F8414C19 /* Materials */, A90A4582D4144797492F5C0806B8A1F5 /* Products */, ); sourceTree = ""; @@ -82,6 +81,14 @@ name = Products; sourceTree = ""; }; + D92946BE29B34E951A7E0714F8414C19 /* Materials */ = { + isa = PBXGroup; + children = ( + ADF252527D202BB9D53E29C86DEEB0F3 /* clear_coat.mat */, + ); + path = Materials; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -134,7 +141,6 @@ 3C183B77078317A8605B572491C58C3A /* Assets.xcassets in Resources */, 76A422929373887929994B3EE3063683 /* LaunchScreen.storyboard in Resources */, D8BDF196DEE56F50D2D15167B4CCC77F /* Main.storyboard in Resources */, - 6AF26A82182F32DB06D1FB51AB97BF1B /* clear_coat.mat in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -157,7 +163,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#/usr/bin/env/bash\n\nset -e\n\n# Compile resources.\n\n# The hello-pbr app requires four resources:\n# 1. The material sphere mesh\n# 2. The Filament material definition\n# 3. The IBL image\n# 4. The skybox image\n# These will be compiled into the final binary via the resgen tool.\n\nfilamesh_path=\"../../../out/release/filament/bin/filamesh\"\nmatc_path=\"../../../out/release/filament/bin/matc\"\nresgen_path=\"../../../out/release/filament/bin/resgen\"\n\n# Ensure that the required tools are present in the out/ directory.\n# These can be built by running ./build.sh -p desktop -i release at Filament's root directory.\n\nif [[ ! -e \"${filamesh_path}\" ]]; then\n echo \"No filamesh binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${resgen_path}\" ]]; then\n echo \"No resgen binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\n# The filamesh tool converts the .obj file into a Filament-specific filamesh file that has been\n# optimized for loading into Filament.\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${filamesh_path}\" \\\n \"${PROJECT_DIR}/../../../assets/models/material_sphere/material_sphere.obj\" \\\n \"${PROJECT_DIR}/generated/material_sphere.filamesh\"\n\n# The matc tool compiles the clear_coat.mat material into a Filament material BLOB.\n\"${matc_path}\" \\\n --api all \\\n --platform mobile \\\n -o \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/hello-pbr/clear_coat.mat\"\n\n# The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked\n# into the final binary. It contains all the resources consumed by the app.\n\"${resgen_path}\" \\\n --deploy=\"${PROJECT_DIR}/generated\" \\\n \"${PROJECT_DIR}/generated/material_sphere.filamesh\" \\\n \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_ibl.ktx\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_skybox.ktx\"\n\n# FilamentApp.cpp and Resources.S include files generated by resgen.\n# Touch them to force Xcode to recompile.\ntouch \"${PROJECT_DIR}/hello-pbr/FilamentApp.cpp\"\ntouch \"${PROJECT_DIR}/hello-pbr/Resources.S\"\n"; + shellScript = "#/usr/bin/env/bash\n\nset -e\n\n# Compile resources.\n\n# The hello-pbr app requires four resources:\n# 1. The material sphere mesh\n# 2. The Filament material definition\n# 3. The IBL image\n# 4. The skybox image\n# These will be compiled into the final binary via the resgen tool.\n\nfilamesh_path=\"../../../out/release/filament/bin/filamesh\"\nmatc_path=\"../../../out/release/filament/bin/matc\"\nresgen_path=\"../../../out/release/filament/bin/resgen\"\n\n# Ensure that the required tools are present in the out/ directory.\n# These can be built by running ./build.sh -p desktop -i release at Filament's root directory.\n\nif [[ ! -e \"${filamesh_path}\" ]]; then\n echo \"No filamesh binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nif [[ ! -e \"${resgen_path}\" ]]; then\n echo \"No resgen binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\n# The filamesh tool converts the .obj file into a Filament-specific filamesh file that has been\n# optimized for loading into Filament.\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${filamesh_path}\" \\\n \"${PROJECT_DIR}/../../../assets/models/material_sphere/material_sphere.obj\" \\\n \"${PROJECT_DIR}/generated/material_sphere.filamesh\"\n\n# The matc tool compiles the clear_coat.mat material into a Filament material BLOB.\n\"${matc_path}\" \\\n --api all \\\n --platform mobile \\\n -o \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/Materials/clear_coat.mat\"\n\n# The resgen tool generates an assembly file, resources.apple.S that gets compiled and linked\n# into the final binary. It contains all the resources consumed by the app.\n\"${resgen_path}\" \\\n --deploy=\"${PROJECT_DIR}/generated\" \\\n \"${PROJECT_DIR}/generated/material_sphere.filamesh\" \\\n \"${PROJECT_DIR}/generated/clear_coat.filamat\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_ibl.ktx\" \\\n \"${PROJECT_DIR}/../../../samples/envs/venetian_crossroads/venetian_crossroads_skybox.ktx\"\n\n# FilamentApp.cpp and Resources.S include files generated by resgen.\n# Touch them to force Xcode to recompile.\ntouch \"${PROJECT_DIR}/hello-pbr/FilamentApp.cpp\"\ntouch \"${PROJECT_DIR}/hello-pbr/Resources.S\"\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/samples/hello-pbr/project.yml b/ios/samples/hello-pbr/project.yml index 964ed71bda..9e05f71059 100644 --- a/ios/samples/hello-pbr/project.yml +++ b/ios/samples/hello-pbr/project.yml @@ -4,7 +4,6 @@ options: include: ../app-template.yml targets: hello-pbr: - sources: hello-pbr/ templates: - FilamentApp settings: diff --git a/ios/samples/hello-triangle/hello-triangle/bakedColor.mat b/ios/samples/hello-triangle/Materials/bakedColor.mat similarity index 100% rename from ios/samples/hello-triangle/hello-triangle/bakedColor.mat rename to ios/samples/hello-triangle/Materials/bakedColor.mat diff --git a/ios/samples/hello-triangle/build-materials.sh b/ios/samples/hello-triangle/build-materials.sh index 332f5e1845..44d1bb53d6 100755 --- a/ios/samples/hello-triangle/build-materials.sh +++ b/ios/samples/hello-triangle/build-materials.sh @@ -10,7 +10,7 @@ mkdir -p "${PROJECT_DIR}/generated/" --api all \ -f header \ -o "${PROJECT_DIR}/generated/bakedColor.inc" \ - "${PROJECT_DIR}/hello-triangle/bakedColor.mat" + "${PROJECT_DIR}/Materials/bakedColor.mat" # FilamentView.mm includes bakedColor.filamat, so touch it to force Xcode to # recompile it. diff --git a/ios/samples/hello-triangle/hello-triangle.xcodeproj/project.pbxproj b/ios/samples/hello-triangle/hello-triangle.xcodeproj/project.pbxproj index 71a287ff7b..81e9f84a41 100644 --- a/ios/samples/hello-triangle/hello-triangle.xcodeproj/project.pbxproj +++ b/ios/samples/hello-triangle/hello-triangle.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 25391681B7E1FAD8C35259C2FB43AA0C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 46A2FAD3D476FDADF45F70F88D39B377 /* LaunchScreen.storyboard */; }; 4831F43B77D0E8C437B64E0CD223DD61 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 45FE9476D47ECFFEA65D7146A57C5807 /* AppDelegate.m */; }; - 9078116F98F9162EEF6347D5290B48D7 /* bakedColor.mat in Resources */ = {isa = PBXBuildFile; fileRef = 6EF92F8A748584AC50D8BE1AFE8BF8FD /* bakedColor.mat */; }; CD70F3CC948993A3E182EEAE716413C0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E56C70616FF30C50DFA8238B177D825B /* main.m */; }; E00008AE8D480B194E25A0D98AB97F2D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 524293A0A8CDE9047347EF48D0651A12 /* Assets.xcassets */; }; E69F0688FDC3C597E6A02DC66C949C82 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDE4A219AEB5B4507F51B8735787157D /* Main.storyboard */; }; @@ -22,9 +21,9 @@ 2620C967534D81CFFAB5D3FFC47A66A3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 350DC65C7EE8D98D8FE181DC993DCB2C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 3BB2247EC7FE4EFB2C3ED10A5046333B /* hello-triangle.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "hello-triangle.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 41033B581E89DF4B33A2EB534A7020C3 /* bakedColor.mat */ = {isa = PBXFileReference; path = bakedColor.mat; sourceTree = ""; }; 45FE9476D47ECFFEA65D7146A57C5807 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 524293A0A8CDE9047347EF48D0651A12 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 6EF92F8A748584AC50D8BE1AFE8BF8FD /* bakedColor.mat */ = {isa = PBXFileReference; path = bakedColor.mat; sourceTree = ""; }; 761A2C7D6295697614AD3434356B8E9E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C16E9A84F33BDFAEDC1E483774DF336C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; C311F8DEBEFEB185F0A7E4CCC6733265 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; @@ -46,17 +45,25 @@ isa = PBXGroup; children = ( C54ABC8D31D1863EF16253A04649C424 /* hello-triangle */, + 8F55D652979868A470D724FA650F6B6B /* Materials */, 39FD47E0213E1FFE59609A06BA1585EA /* Products */, ); sourceTree = ""; }; + 8F55D652979868A470D724FA650F6B6B /* Materials */ = { + isa = PBXGroup; + children = ( + 41033B581E89DF4B33A2EB534A7020C3 /* bakedColor.mat */, + ); + path = Materials; + sourceTree = ""; + }; C54ABC8D31D1863EF16253A04649C424 /* hello-triangle */ = { isa = PBXGroup; children = ( C16E9A84F33BDFAEDC1E483774DF336C /* AppDelegate.h */, 45FE9476D47ECFFEA65D7146A57C5807 /* AppDelegate.m */, 524293A0A8CDE9047347EF48D0651A12 /* Assets.xcassets */, - 6EF92F8A748584AC50D8BE1AFE8BF8FD /* bakedColor.mat */, CDBB6BE341D1C708FCB687507015103B /* FilamentView.h */, 0CDCD26337640C57D07E41ED006B9C6D /* FilamentView.mm */, 761A2C7D6295697614AD3434356B8E9E /* Info.plist */, @@ -121,7 +128,6 @@ E00008AE8D480B194E25A0D98AB97F2D /* Assets.xcassets in Resources */, 25391681B7E1FAD8C35259C2FB43AA0C /* LaunchScreen.storyboard in Resources */, E69F0688FDC3C597E6A02DC66C949C82 /* Main.storyboard in Resources */, - 9078116F98F9162EEF6347D5290B48D7 /* bakedColor.mat in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -144,7 +150,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Compile bakedColor material.\nmatc_path=\"../../../out/release/filament/bin/matc\"\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${matc_path}\" \\\n --api all \\\n -f header \\\n -o \"${PROJECT_DIR}/generated/bakedColor.inc\" \\\n \"${PROJECT_DIR}/hello-triangle/bakedColor.mat\"\n\n# FilamentView.mm includes bakedColor.filamat, so touch it to force Xcode to\n# recompile it.\ntouch \"${PROJECT_DIR}/hello-triangle/FilamentView.mm\"\n"; + shellScript = "# Compile bakedColor material.\nmatc_path=\"../../../out/release/filament/bin/matc\"\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${matc_path}\" \\\n --api all \\\n -f header \\\n -o \"${PROJECT_DIR}/generated/bakedColor.inc\" \\\n \"${PROJECT_DIR}/Materials/bakedColor.mat\"\n\n# FilamentView.mm includes bakedColor.filamat, so touch it to force Xcode to\n# recompile it.\ntouch \"${PROJECT_DIR}/hello-triangle/FilamentView.mm\"\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/samples/hello-triangle/project.yml b/ios/samples/hello-triangle/project.yml index df8750fb56..439086d67b 100644 --- a/ios/samples/hello-triangle/project.yml +++ b/ios/samples/hello-triangle/project.yml @@ -4,7 +4,6 @@ options: include: ../app-template.yml targets: hello-triangle: - sources: hello-triangle/ templates: - FilamentApp preBuildScripts: diff --git a/ios/samples/transparent-rendering/transparent-rendering/bakedColor.mat b/ios/samples/transparent-rendering/Materials/bakedColor.mat similarity index 100% rename from ios/samples/transparent-rendering/transparent-rendering/bakedColor.mat rename to ios/samples/transparent-rendering/Materials/bakedColor.mat diff --git a/ios/samples/transparent-rendering/build-materials.sh b/ios/samples/transparent-rendering/build-materials.sh index d6505019fb..0e3ab7d9da 100755 --- a/ios/samples/transparent-rendering/build-materials.sh +++ b/ios/samples/transparent-rendering/build-materials.sh @@ -10,7 +10,7 @@ mkdir -p "${PROJECT_DIR}/generated/" --api all \ -f header \ -o "${PROJECT_DIR}/generated/bakedColor.inc" \ - "${PROJECT_DIR}/transparent-rendering/bakedColor.mat" + "${PROJECT_DIR}/Materials/bakedColor.mat" # FilamentView.mm includes bakedColor.filamat, so touch it to force Xcode to # recompile it. diff --git a/ios/samples/transparent-rendering/transparent-rendering.xcodeproj/project.pbxproj b/ios/samples/transparent-rendering/transparent-rendering.xcodeproj/project.pbxproj index bd9183fb39..f88ab9d4a4 100644 --- a/ios/samples/transparent-rendering/transparent-rendering.xcodeproj/project.pbxproj +++ b/ios/samples/transparent-rendering/transparent-rendering.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 0199A24B4425075544822C41830D7DB7 /* bakedColor.mat in Resources */ = {isa = PBXBuildFile; fileRef = CAE287C4D9E366414D58622A67F7AB9E /* bakedColor.mat */; }; 3FB8BA8E8EF35B02FA9B9A2A05742541 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E6D9072BB2A497EEE9A7B662D8748BEC /* ViewController.m */; }; 59D33796D272698CC32F467B9E4070E7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 959043C1F56EAAE872B0FF053275601D /* Main.storyboard */; }; 930B93DD5BE4C0E185B175B3189D0DB4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AA728ADDAAE09D3A5FD80C827A830C50 /* main.m */; }; @@ -28,7 +27,6 @@ AA728ADDAAE09D3A5FD80C827A830C50 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; BD21E933E2F77EE5ACBCDD5FE34ED052 /* FilamentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentView.h; sourceTree = ""; }; C8CF5D9EB8BA11B44F639DFE95873630 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - CAE287C4D9E366414D58622A67F7AB9E /* bakedColor.mat */ = {isa = PBXFileReference; path = bakedColor.mat; sourceTree = ""; }; E6D9072BB2A497EEE9A7B662D8748BEC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; E749A05E4E5F36757FB9399C16EE3935 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -56,7 +54,6 @@ 0A8B371B11D177469DFEBB86FD3795F2 /* AppDelegate.h */, C8CF5D9EB8BA11B44F639DFE95873630 /* AppDelegate.m */, E749A05E4E5F36757FB9399C16EE3935 /* Assets.xcassets */, - CAE287C4D9E366414D58622A67F7AB9E /* bakedColor.mat */, BD21E933E2F77EE5ACBCDD5FE34ED052 /* FilamentView.h */, 1A807B46A326F19ABCEE0D6222FAC92F /* FilamentView.mm */, 952B0BE8EFAEF9B6FCB7779871BE58C5 /* Info.plist */, @@ -121,7 +118,6 @@ C63FD3358C5F1C071283C2C4BEEB6BEF /* Assets.xcassets in Resources */, B6B90F5B2475B35662BEBCB72A0FD29C /* LaunchScreen.storyboard in Resources */, 59D33796D272698CC32F467B9E4070E7 /* Main.storyboard in Resources */, - 0199A24B4425075544822C41830D7DB7 /* bakedColor.mat in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -144,7 +140,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Compile bakedColor material.\nmatc_path=\"../../../out/release/filament/bin/matc\"\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${matc_path}\" \\\n --api all \\\n -f header \\\n -o \"${PROJECT_DIR}/generated/bakedColor.inc\" \\\n \"${PROJECT_DIR}/transparent-rendering/bakedColor.mat\"\n\n# FilamentView.mm includes bakedColor.filamat, so touch it to force Xcode to\n# recompile it.\ntouch \"${PROJECT_DIR}/transparent-rendering/FilamentView.mm\"\n"; + shellScript = "# Compile bakedColor material.\nmatc_path=\"../../../out/release/filament/bin/matc\"\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"No matc binary could be found in ../../../out/release/filament/bin/.\"\n echo \"Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${matc_path}\" \\\n --api all \\\n -f header \\\n -o \"${PROJECT_DIR}/generated/bakedColor.inc\" \\\n \"${PROJECT_DIR}/Materials/bakedColor.mat\"\n\n# FilamentView.mm includes bakedColor.filamat, so touch it to force Xcode to\n# recompile it.\ntouch \"${PROJECT_DIR}/transparent-rendering/FilamentView.mm\"\n"; }; /* End PBXShellScriptBuildPhase section */