]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ResourceTextureCache.java
Set copyright texts for java files in the latest development branches.
[simantics/3d.git] / org.simantics.proconf.g3d / src / org / simantics / proconf / g3d / base / ResourceTextureCache.java
index 33b189007ceb584c2deab511ffd1b3c08dae958b..10ff6ce9b2fb03798d56b26a50c89c1a12084d19 100644 (file)
@@ -1,3 +1,13 @@
+/*******************************************************************************\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
@@ -18,7 +28,6 @@ import org.simantics.utils.ui.gfx.PixelDimension;
 \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
@@ -26,6 +35,7 @@ import com.jme.util.TextureManager;
  * 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
@@ -53,19 +63,13 @@ public class ResourceTextureCache {
                        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
@@ -167,7 +171,7 @@ public class ResourceTextureCache {
                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