Here you can find the source of texture2D(BufferedImage normalMap, int x, int y)
Parameter | Description |
---|---|
x | a parameter |
y | a parameter |
normalMap | a parameter |
private static float[] texture2D(BufferedImage normalMap, int x, int y)
//package com.java2s; /*// w ww . jav a2s . c om CCH World Factory - GPL Copyright (C) 2014 Christopher Collin Hall email: explosivegnome@yahoo.com CCH World Factory - GPL is distributed under the GNU General Public License (GPL) version 3. A non-GPL branch of the CCH World Factory also exists. For non-GPL licensing options, contact the copyright holder, Christopher Collin Hall (explosivegnome@yahoo.com). CCH World Factory - GPL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. CCH World Factory - GPL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with CCH World Factory - GPL. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.image.BufferedImage; public class Main { /** * Acts like GLSL function of same name * @param x * @param y * @param normalMap * @return */ private static float[] texture2D(BufferedImage normalMap, int x, int y) { int argb = normalMap.getRGB(x, y); float[] vec4 = new float[4]; vec4[0] = ((argb >> 16) & 0xFF) / 255f; vec4[1] = ((argb >> 8) & 0xFF) / 255f; vec4[2] = ((argb) & 0xFF) / 255f; vec4[3] = ((argb >> 24) & 0xFF) / 255f; return vec4; } }