hi,
i have a little problem when i want to load a .png file from a cutom directory. it was said that i have to register a locator to the assetmanager, but i dont get what im doing wrong.
[java]
main.getAssetManager().registerLocator(System.getProperty("user.home") + "/SurCraft/Temp/", FileLocator.class);
mat_terrain.setTexture("m_Alpha", main.getAssetManager().loadTexture(System.getProperty("user.home") + "/SurCraft/Temp/AlphaMap.png"));
[/java]
i registered the locator and i always get com.jme3.asset.AssetNotFoundException: C:/Users/wizz/SurCraft/Temp/AlphaMap.png
or is there a way to convert an image object to a texture ? then i dont need to load the file. if there is one, im still interested for the solution of the first part
thx for any help
You registered the locator to SurCraft/Temp already, hence the path for loading is just “AlphaMap.png”.
sure…“facepalm”. that did the trick, thx for the fast help
if this assets are not contained in project(for example empty project with assets only, then you don’t have SDK power ).
But this is only my suggestion.
not quite sure what u mean, im not the best in english but i will have the same problem when i want to load my maps in the game. if im not wrong, i have to use the assetmanager as well? im using the HeightBasedAlphaMapGenerator i found in this forum to generate an alpha map out of my hillheightmap so that i can use texture splatting from generated heightmaps. the thing is that i get an image object as alpha map and im not so in jme that i found a way out to directly convert an image to texture. so i have to store the image and load it with assetmanager to get my texture object.
The cache will probably mess you up in that case.
There are numerous forum posts on converting a Java Image to a texture. Just use the custom google search box in the upper right (not the regular search box because that one sucks).