Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve issue #1497 (DesktopAssetManager is a misnomer) #1506

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
*
* @author Kirill Vainer
*/
public class DesktopAssetManager implements AssetManager {
public class DefaultAssetManager implements AssetManager {

private static final Logger logger = Logger.getLogger(AssetManager.class.getName());
private ShaderGenerator shaderGenerator;
Expand All @@ -76,19 +76,19 @@ public class DesktopAssetManager implements AssetManager {
final private List<ClassLoader> classLoaders =
Collections.synchronizedList(new ArrayList<>());

public DesktopAssetManager(){
public DefaultAssetManager(){
this(null);
}

public DesktopAssetManager(boolean usePlatformConfig){
public DefaultAssetManager(boolean usePlatformConfig){
this(usePlatformConfig ? JmeSystem.getPlatformAssetConfigURL() : null);
}

public DesktopAssetManager(URL configFile){
public DefaultAssetManager(URL configFile){
if (configFile != null){
loadConfigFile(configFile);
}
logger.fine("DesktopAssetManager created.");
logger.fine("DefaultAssetManager created.");
}

private void loadConfigFile(URL configFile) {
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/asset/ImplHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected T initialValue(){

/**
* Establishes the asset key that is used for tracking dependent assets
* that have failed to load. When set, the {@link DesktopAssetManager}
* that have failed to load. When set, the {@link DefaultAssetManager}
* gets a hint that it should suppress {@link AssetNotFoundException}s
* and instead call the listener callback (if set).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
package com.jme3.system;

import com.jme3.asset.AssetManager;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.asset.DefaultAssetManager;
import com.jme3.audio.AudioRenderer;
import com.jme3.input.SoftTextDialogInput;
import java.io.File;
Expand Down Expand Up @@ -122,11 +122,11 @@ public SoftTextDialogInput getSoftTextDialogInput() {
}

public final AssetManager newAssetManager(URL configFile) {
return new DesktopAssetManager(configFile);
return new DefaultAssetManager(configFile);
}

public final AssetManager newAssetManager() {
return new DesktopAssetManager(null);
return new DefaultAssetManager(null);
}

public abstract void writeImageFile(OutputStream outStream, String format, ByteBuffer imageData, int width, int height) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class LoadShaderSourceTest {
@Test
public void testLoadShaderSource() {
JmeSystem.setSystemDelegate(new MockJmeSystemDelegate());
AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
assetManager.registerLocator(null, ClasspathLocator.class);
assetManager.registerLoader(GLSLLoader.class, "frag");
assetManager.registerLoader(GLSLLoader.class, "glsllib");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
package com.jme3.collision;

import com.jme3.asset.AssetManager;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.asset.DefaultAssetManager;
import com.jme3.asset.plugins.ClasspathLocator;
import com.jme3.material.Material;
import com.jme3.material.plugins.J3MLoader;
Expand Down Expand Up @@ -90,7 +90,7 @@ void createRedSquare() {
@Test
public void testPhantomTriangles() {
JmeSystem.setSystemDelegate(new MockJmeSystemDelegate());
assetManager = new DesktopAssetManager();
assetManager = new DefaultAssetManager();
assetManager.registerLocator(null, ClasspathLocator.class);
assetManager.registerLoader(J3MLoader.class, "j3m", "j3md");
rootNode = new Node();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
package com.jme3.scene;

import com.jme3.asset.AssetManager;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.asset.DefaultAssetManager;
import com.jme3.asset.plugins.ClasspathLocator;
import com.jme3.collision.CollisionResult;
import com.jme3.collision.CollisionResults;
Expand Down Expand Up @@ -117,7 +117,7 @@ void createWhiteLines() {
@Test
public void testPhantomTriangles() {
JmeSystem.setSystemDelegate(new MockJmeSystemDelegate());
assetManager = new DesktopAssetManager();
assetManager = new DefaultAssetManager();
assetManager.registerLocator(null, ClasspathLocator.class);
assetManager.registerLoader(J3MLoader.class, "j3m", "j3md");
rootNode = new Node();
Expand Down
20 changes: 10 additions & 10 deletions jme3-core/src/test/java/com/jme3/scene/debug/TestCloneMesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.jme3.animation.Bone;
import com.jme3.animation.Skeleton;
import com.jme3.asset.AssetManager;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.asset.DefaultAssetManager;
import com.jme3.export.binary.BinaryExporter;
import com.jme3.math.Vector3f;
import com.jme3.util.clone.Cloner;
Expand Down Expand Up @@ -63,7 +63,7 @@ public void testCloneArrow() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, arrow);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
Arrow saveAndLoad = BinaryExporter.saveAndLoad(assetManager, arrow);
Assert.assertNotNull(saveAndLoad);
Assert.assertNotEquals(deepClone, saveAndLoad);
Expand All @@ -80,7 +80,7 @@ public void testCloneGrid() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, grid);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
Grid saveAndLoad = BinaryExporter.saveAndLoad(assetManager, grid);
Assert.assertNotNull(saveAndLoad);
Assert.assertNotEquals(deepClone, saveAndLoad);
Expand All @@ -103,7 +103,7 @@ public void testCloneSkeletonDebugger() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, skeletonDebugger);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
SkeletonDebugger saveAndLoad
= BinaryExporter.saveAndLoad(assetManager, skeletonDebugger);
Assert.assertNotNull(saveAndLoad);
Expand All @@ -130,7 +130,7 @@ public void testCloneSkeletonInterBoneWire() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, sibw);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
SkeletonInterBoneWire saveAndLoad
= BinaryExporter.saveAndLoad(assetManager, sibw);
Assert.assertNotNull(saveAndLoad);
Expand All @@ -153,7 +153,7 @@ public void testCloneSkeletonPoints() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, skeletonPoints);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
SkeletonPoints saveAndLoad
= BinaryExporter.saveAndLoad(assetManager, skeletonPoints);
Assert.assertNotNull(saveAndLoad);
Expand All @@ -175,7 +175,7 @@ public void testCloneSkeletonWire() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, skeletonWire);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
SkeletonWire saveAndLoad
= BinaryExporter.saveAndLoad(assetManager, skeletonWire);
Assert.assertNotNull(saveAndLoad);
Expand All @@ -193,7 +193,7 @@ public void testCloneWireBox() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, box);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
WireBox saveAndLoad = BinaryExporter.saveAndLoad(assetManager, box);
Assert.assertNotNull(saveAndLoad);
Assert.assertNotEquals(deepClone, saveAndLoad);
Expand All @@ -210,7 +210,7 @@ public void testCloneWireSphere() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, sphere);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
WireSphere saveAndLoad
= BinaryExporter.saveAndLoad(assetManager, sphere);
Assert.assertNotNull(saveAndLoad);
Expand All @@ -231,7 +231,7 @@ public void testIssue1462() {
Assert.assertNotNull(deepClone);
Assert.assertNotEquals(deepClone, wireFrustum);

AssetManager assetManager = new DesktopAssetManager();
AssetManager assetManager = new DefaultAssetManager();
WireFrustum saveAndLoad
= BinaryExporter.saveAndLoad(assetManager, wireFrustum);
Assert.assertNotNull(saveAndLoad);
Expand Down
4 changes: 2 additions & 2 deletions jme3-core/src/test/java/com/jme3/system/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

import com.jme3.asset.AssetConfig;
import com.jme3.asset.AssetManager;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.asset.DefaultAssetManager;
import com.jme3.renderer.RenderManager;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -52,7 +52,7 @@ private TestUtil() {

public static AssetManager createAssetManager() {
Logger.getLogger(AssetConfig.class.getName()).setLevel(Level.OFF);
return new DesktopAssetManager(true);
return new DefaultAssetManager(true);
}

public static RenderManager createRenderManager() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void main( String... args ) throws Exception {
dump("", clone);

System.out.println("-------- cloning BitmapText ------------");
DesktopAssetManager assets = new DesktopAssetManager(true);
DefaultAssetManager assets = new DefaultAssetManager(true);
BitmapFont font = assets.loadFont("Interface/Fonts/Console.fnt");
BitmapText text1 = new BitmapText(font);
text1.setText("Testing");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* This class provides some utility functions to properly test the jMonkeyEngine.<br>
* Thus it contains simple methods to get and create a headless assetManager amongst other things.<br>
* In comparison to {@link BaseTest} it provides a DesktopAssetManager capable of loading image formats using AWT, which
* In comparison to {@link BaseTest} it provides a DefaultAssetManager capable of loading image formats using AWT, which
* however makes those tests unsuitable for headless ci testing. This requires jme3-desktop to be a testRuntime dependency.
*
* @author MeFisto94
Expand Down