public static Vector3f getVectorFromCubemapFaceTexCoord(int x, int y, int mapSize, int face, Vector3f store, FixSeamsMethod fixSeamsMethod) {
        if (store == null) {
            store = new Vector3f();
        }

        float u;
        float v;

        if (fixSeamsMethod == FixSeamsMethod.Stretch) {
            /* Code from Nvtt : https://github.com/castano/nvidia-texture-tools/blob/master/src/nvtt/CubeSurface.cpp#L77
             * transform from [0..res - 1] to [-1 .. 1], match up edges exactly. */
            u = (2.0f * x / (mapSize - 1.0f)) - 1.0f;
            v = (2.0f * y / (mapSize - 1.0f)) - 1.0f;
        } else {
            //Done if any other fix method or no fix method is set
            /* transform from [0..res - 1] to [- (1 - 1 / res) .. (1 - 1 / res)]
             * (+ 0.5f is for texel center addressing) */
            u = (2.0f * (x + 0.5f) / mapSize) - 1.0f;
            v = (2.0f * (y + 0.5f) / mapSize) - 1.0f;
        }

        if (fixSeamsMethod == FixSeamsMethod.Wrap) {
            // Warp texel centers in the proximity of the edges.
            float a = pow(mapSize, 2.0f) / pow(mapSize - 1f, 3.0f);
            u = a * pow(u, 3f) + u;
            v = a * pow(v, 3f) + v;
        }

        //compute vector depending on the face
        // Code from Nvtt : https://github.com/castano/nvidia-texture-tools/blob/master/src/nvtt/CubeSurface.cpp#L101
        switch (face) {
            case 0:
                store.set(1f, -v, -u);
                break;
            case 1:
                store.set(-1f, -v, u);
                break;
            case 2:
                store.set(u, 1f, v);
                break;
            case 3:
                store.set(u, -1f, -v);
                break;
            case 4:
                store.set(u, -v, 1f);
                break;
            case 5:
                store.set(-u, -v, -1.0f);
                break;
        }

        return store.normalizeLocal();
    }
Computes the 3 component vector coordinates for the given face and coords

@param x the x texture coordinate
@param y the y texture coordinate
@param mapSize the size of a face of the cube map
@param face the face to consider
@param store a vector3f where the resulting vector will be stored
@param fixSeamsMethod the method to fix the seams
@return either store or a new vector
jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java