Android Open Source - Texample2 Texture Region






From Project

Back to project page Texample2.

License

The source code is released under:

CC0 1.0 Universal http://creativecommons.org/publicdomain/zero/1.0/legalcode

If you think the Android project Texample2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.android.texample2;
/*from  w ww  .  j  ava  2 s.  c o m*/

class TextureRegion {

   //--Members--//
   public float u1, v1;                               // Top/Left U,V Coordinates
   public float u2, v2;                               // Bottom/Right U,V Coordinates

   //--Constructor--//
   // D: calculate U,V coordinates from specified texture coordinates
   // A: texWidth, texHeight - the width and height of the texture the region is for
   //    x, y - the top/left (x,y) of the region on the texture (in pixels)
   //    width, height - the width and height of the region on the texture (in pixels)
   public TextureRegion(float texWidth, float texHeight, float x, float y, float width, float height)  {
      this.u1 = x / texWidth;                         // Calculate U1
      this.v1 = y / texHeight;                        // Calculate V1
      this.u2 = this.u1 + ( width / texWidth );       // Calculate U2
      this.v2 = this.v1 + ( height / texHeight );     // Calculate V2
   }
}




Java Source Code List

com.android.texample2.AttribVariable.java
com.android.texample2.AttribVariable.java
com.android.texample2.GLText.java
com.android.texample2.GLText.java
com.android.texample2.SpriteBatch.java
com.android.texample2.SpriteBatch.java
com.android.texample2.Texample2Renderer.java
com.android.texample2.Texample2Renderer.java
com.android.texample2.Texample2.java
com.android.texample2.Texample2.java
com.android.texample2.TextureHelper.java
com.android.texample2.TextureHelper.java
com.android.texample2.TextureRegion.java
com.android.texample2.TextureRegion.java
com.android.texample2.Triangle.java
com.android.texample2.Triangle.java
com.android.texample2.Utilities.java
com.android.texample2.Utilities.java
com.android.texample2.Vertices.java
com.android.texample2.Vertices.java
com.android.texample2.programs.BatchTextProgram.java
com.android.texample2.programs.BatchTextProgram.java
com.android.texample2.programs.Program.java
com.android.texample2.programs.Program.java