Просмотр исходного кода

Support for BGR8 and RGBA8 texture formats added (credits to madlion for finding that :) ).

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7562 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Kae..pl 14 лет назад
Родитель
Сommit
9a74373da3

+ 32 - 0
engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/TextureHelper.java

@@ -1086,6 +1086,38 @@ public class TextureHelper extends AbstractBlenderHelper {
 				newData.put(dataIndex++, (byte) (resultPixel[0] * 255.0f));
 				newData.put(dataIndex++, (byte) (resultPixel[1] * 255.0f));
 				newData.put(dataIndex++, (byte) (resultPixel[2] * 255.0f));
+			} else if (format == Format.RGBA8) {
+                pixelValue = data.get();
+                texPixel[1] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;
+                if(neg) {
+                    texPixel[1] = 1.0f - texPixel[1];
+                }
+                pixelValue = data.get();
+                texPixel[2] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;
+                if(neg) {
+                    texPixel[2] = 1.0f - texPixel[2];
+                }
+                data.get(); // ignore alpha
+                this.blendPixel(resultPixel, materialColor, texPixel, 1.0f, affectFactor, blendType, dataRepository);
+                newData.put(dataIndex++, (byte) (resultPixel[0] * 255.0f));
+                newData.put(dataIndex++, (byte) (resultPixel[1] * 255.0f));
+                newData.put(dataIndex++, (byte) (resultPixel[2] * 255.0f));
+			} else if (format == Format.BGR8) {
+                texPixel[2] = texPixel[0];
+                pixelValue = data.get();
+                texPixel[1] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;
+                if(neg) {
+                    texPixel[1] = 1.0f - texPixel[1];
+                }
+                pixelValue = data.get();
+                texPixel[0] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;
+                if(neg) {
+                    texPixel[0] = 1.0f - texPixel[0];
+                }
+                this.blendPixel(resultPixel, materialColor, texPixel, 1.0f, affectFactor, blendType, dataRepository);
+                newData.put(dataIndex++, (byte) (resultPixel[0] * 255.0f));
+                newData.put(dataIndex++, (byte) (resultPixel[1] * 255.0f));
+                newData.put(dataIndex++, (byte) (resultPixel[2] * 255.0f));
 			} else if (format == Format.Luminance8) {
 				this.blendPixel(resultPixel, materialColor, color, texPixel[0], affectFactor, blendType, dataRepository);
 				newData.put((byte) (resultPixel[0] * 255.0f));