@@ -25,7 +25,6 @@ of this software and associated documentation files (the "Software"), to deal
2525import com .github .stephengold .joltjni .*;
2626import com .github .stephengold .joltjni .enumerate .EPhysicsUpdateError ;
2727import com .github .stephengold .joltjni .std .OfStream ;
28- import java .nio .ByteBuffer ;
2928import testjoltjni .TestUtils ;
3029import testjoltjni .app .samples .broadphase .*;
3130import testjoltjni .app .samples .character .*;
@@ -156,13 +155,15 @@ private static void createSharedObjects() {
156155
157156 case "Metal" :
158157 // Assign a loader for Metal compute shaders:
159- Loader mtlLoader = makeLoader ("/mtl/com/github/stephengold" );
158+ Loader mtlLoader = CustomLoader .newLoader (
159+ "/mtl/com/github/stephengold" );
160160 computeSystem .setShaderLoader (mtlLoader );
161161 break ;
162162
163163 case "Vulkan" :
164164 // Assign a loader for Vulkan compute shaders:
165- Loader vkLoader = makeLoader ("/vk/com/github/stephengold" );
165+ Loader vkLoader = CustomLoader .newLoader (
166+ "/vk/com/github/stephengold" );
166167 computeSystem .setShaderLoader (vkLoader );
167168 break ;
168169
@@ -177,25 +178,6 @@ private static void createSharedObjects() {
177178 queue = queueRef .getPtr ();
178179 }
179180
180- /**
181- * Create a custom loader that loads from the specified resource directory.
182- *
183- * @param resourcePath the path to the resource directory (not {@code null})
184- * @return a new loader
185- */
186- private static Loader makeLoader (String resourcePath ) {
187- Loader result = new CustomLoader () {
188- @ Override
189- public ByteBuffer loadShader (String shaderName ) {
190- String path = resourcePath + "/" + shaderName ;
191- ByteBuffer result = Jolt .loadResourceAsBytes (path );
192- return result ;
193- }
194- };
195-
196- return result ;
197- }
198-
199181 /**
200182 * Allocate and initialize a {@code PhysicsSystem} in the customary
201183 * configuration.
0 commit comments