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

Cubemap Not added to the management. #5047

Closed
chongbo2013 opened this issue Jan 2, 2018 · 0 comments
Closed

Cubemap Not added to the management. #5047

chongbo2013 opened this issue Jan 2, 2018 · 0 comments

Comments

@chongbo2013
Copy link

Not added to the management, resulting in texture black blocks or not loaded, because I fix it
addManagedCubemap private to public

private static void addManagedCubemap (Application app, Cubemap cubemap) {
Array managedCubemapArray = managedCubemaps.get(app);
if (managedCubemapArray == null) managedCubemapArray = new Array();
managedCubemapArray.add(cubemap);
managedCubemaps.put(app, managedCubemapArray);
}

public static void invalidateAllCubemaps(Application app) {
Array managedCubemapArray = (Array)managedCubemaps.get(app);
if(managedCubemapArray != null) {
if(assetManager == null) {
for(int i = 0; i < managedCubemapArray.size; ++i) {
Cubemap cubemap = (Cubemap)managedCubemapArray.get(i);
cubemap.reload();
}
} else {
assetManager.finishLoading();
Array cubemaps = new Array(managedCubemapArray);
Iterator var9 = cubemaps.iterator();

            while(var9.hasNext()) {
                Cubemap cubemap = (Cubemap)var9.next();
                String fileName = assetManager.getAssetFileName(cubemap);
                if(fileName == null) {
                    cubemap.reload();
                } else {
                    final int refCount = assetManager.getReferenceCount(fileName);
                    assetManager.setReferenceCount(fileName, 0);
                    cubemap.glHandle = 0;
                    CubemapParameter params = new CubemapParameter();
                    params.cubemapData = cubemap.getCubemapData();
                    params.minFilter = cubemap.getMinFilter();
                    params.magFilter = cubemap.getMagFilter();
                    params.wrapU = cubemap.getUWrap();
                    params.wrapV = cubemap.getVWrap();
                    params.cubemap = cubemap;
                    params.loadedCallback = new LoadedCallback() {
                        public void finishedLoading(AssetManager assetManager, String fileName, Class type) {
                            assetManager.setReferenceCount(fileName, refCount);
                        }
                    };
                    assetManager.unload(fileName);
                    cubemap.glHandle = Gdx.gl.glGenTexture();
                    assetManager.load(fileName, Cubemap.class, params);
                }
            }

            managedCubemapArray.clear();
            managedCubemapArray.addAll(cubemaps);
        }

    }
}
mgsx-dev added a commit to mgsx-dev/libgdx that referenced this issue Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants