+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
package org.simantics.proconf.g3d.base;\r
\r
import java.nio.ByteBuffer;\r
\r
import com.jme.image.Image;\r
import com.jme.image.Texture;\r
-import com.jme.util.TextureManager;\r
\r
/**\r
* Caches resource based textures.\r
* TODO : either use shared context or use separate cache for each editor\r
* TODO : ShapeNode implementation won't use release texture yet\r
* TODO : Texture is released when reference count goes to zero; we probably want to wait for a while before texture is released because it might be used again.\r
+ * TODO : Support for other types of textures (not just pattern texture, preferably extensible interface)\r
* \r
* @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
*\r
ImageTexture it = new ImageTexture(g,res);\r
org.simantics.image.stubs.Image pattern = it.getImage();\r
Image image = loadImage(g, pattern.getResource());\r
-// image.getData().rewind();\r
-// while (image.getData().hasRemaining())\r
-// image.getData().put((byte)(Math.random()*256.0 - 127.0));\r
+\r
if (image == null) {\r
return null;\r
}\r
t = new Texture();\r
t.setImage(image);\r
\r
- //t = TextureManager.loadTexture(image, Texture.MM_LINEAR, Texture.FM_LINEAR);\r
-// t.setImageLocation(res.toString());\r
-// URL url = FileLocator.find(com.jme.eclipse.Activator.getDefault().getBundle(),new Path("data/texture/clouds.png"),null);\r
-// t = TextureManager.loadTexture(url, Texture.MM_LINEAR, Texture.FM_LINEAR);\r
\r
t.setFilter(com.jme.image.Texture.FM_LINEAR);\r
t.setMipmapState(com.jme.image.Texture.MM_LINEAR);\r
return instance;\r
}\r
\r
- private static Image getImage(ImageData imageData) {\r
+ public static Image getImage(ImageData imageData) {\r
int width = imageData.width;\r
int height = imageData.height;\r
int type = 0;\r