Java Code Examples for com.jme3.math.Vector2f#multLocal()
The following examples show how to use
com.jme3.math.Vector2f#multLocal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HDRRenderer.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private Material createLumShader(int srcW, int srcH, int bufW, int bufH, int mode, int iters, Texture tex){ Material mat = new Material(manager, "Common/MatDefs/Hdr/LogLum.j3md"); Vector2f blockSize = new Vector2f(1f / bufW, 1f / bufH); Vector2f pixelSize = new Vector2f(1f / srcW, 1f / srcH); Vector2f blocks = new Vector2f(); float numPixels = Float.POSITIVE_INFINITY; if (iters != -1){ do { pixelSize.multLocal(2); blocks.set(blockSize.x / pixelSize.x, blockSize.y / pixelSize.y); numPixels = blocks.x * blocks.y; } while (numPixels > iters); }else{ blocks.set(blockSize.x / pixelSize.x, blockSize.y / pixelSize.y); numPixels = blocks.x * blocks.y; } mat.setBoolean("Blocks", true); if (mode == LUMMODE_ENCODE_LUM) mat.setBoolean("EncodeLum", true); else if (mode == LUMMODE_DECODE_LUM) mat.setBoolean("DecodeLum", true); mat.setTexture("Texture", tex); mat.setVector2("BlockSize", blockSize); mat.setVector2("PixelSize", pixelSize); mat.setFloat("NumPixels", numPixels); return mat; }
Example 2
Source File: HDRRenderer.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private Material createLumShader(int srcW, int srcH, int bufW, int bufH, int mode, int iters, Texture tex){ Material mat = new Material(manager, "Common/MatDefs/Hdr/LogLum.j3md"); Vector2f blockSize = new Vector2f(1f / bufW, 1f / bufH); Vector2f pixelSize = new Vector2f(1f / srcW, 1f / srcH); Vector2f blocks = new Vector2f(); float numPixels = Float.POSITIVE_INFINITY; if (iters != -1){ do { pixelSize.multLocal(2); blocks.set(blockSize.x / pixelSize.x, blockSize.y / pixelSize.y); numPixels = blocks.x * blocks.y; } while (numPixels > iters); }else{ blocks.set(blockSize.x / pixelSize.x, blockSize.y / pixelSize.y); numPixels = blocks.x * blocks.y; } System.out.println(numPixels); mat.setBoolean("Blocks", true); if (mode == LUMMODE_ENCODE_LUM) mat.setBoolean("EncodeLum", true); else if (mode == LUMMODE_DECODE_LUM) mat.setBoolean("DecodeLum", true); mat.setTexture("Texture", tex); mat.setVector2("BlockSize", blockSize); mat.setVector2("PixelSize", pixelSize); mat.setFloat("NumPixels", numPixels); return mat; }
Example 3
Source File: BufferUtils.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * Multiply and store a Vector2f in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector2f within * @param index * the position (in terms of vectors, not floats) of the vector * to multiply */ public static void multInBuffer(Vector2f toMult, FloatBuffer buf, int index) { TempVars vars = TempVars.get(); Vector2f tempVec2 = vars.vect2d; populateFromBuffer(tempVec2, buf, index); tempVec2.multLocal(toMult); setInBuffer(tempVec2, buf, index); vars.release(); }
Example 4
Source File: BufferUtils.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 3 votes |
/** * Multiply and store a Vector2f in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector2f within * @param index * the position (in terms of vectors, not floats) of the vector * to multiply */ public static void multInBuffer(Vector2f toMult, FloatBuffer buf, int index) { TempVars vars = TempVars.get(); Vector2f tempVec2 = vars.vect2d; populateFromBuffer(tempVec2, buf, index); tempVec2.multLocal(toMult); setInBuffer(tempVec2, buf, index); vars.release(); }