예제 #1
0
 /**
  * Copies every property from another ATexture object
  *
  * @param other another ATexture object to copy from
  */
 public void setFrom(ATexture other) {
   mTextureId = other.getTextureId();
   mUniformHandle = other.getUniformHandle();
   mWidth = other.getWidth();
   mHeight = other.getHeight();
   mBitmapFormat = other.getBitmapFormat();
   mMipmap = other.isMipmap();
   mShouldRecycle = other.willRecycle();
   mTextureName = other.getTextureName();
   mTextureType = other.getTextureType();
   mWrapType = other.getWrapType();
   mFilterType = other.getFilterType();
   mBitmapConfig = other.getBitmapConfig();
   mCompressedTexture = other.getCompressedTexture();
   mGLTextureType = other.getGLTextureType();
 }
  @Override
  public void main() {
    super.main();
    RVec4 color = (RVec4) getGlobal(DefaultShaderVar.G_COLOR);
    RVec2 textureCoord = (RVec2) getGlobal(DefaultShaderVar.G_TEXTURE_COORD);
    RVec4 texColor = new RVec4("texColor");

    for (int i = 0; i < mTextures.size(); i++) {
      ATexture texture = mTextures.get(i);
      if (texture.offsetEnabled()) textureCoord.assignAdd(getGlobal(DefaultShaderVar.U_OFFSET, i));
      if (texture.getWrapType() == WrapType.REPEAT)
        textureCoord.assignMultiply(getGlobal(DefaultShaderVar.U_REPEAT, i));

      if (texture.getTextureType() == TextureType.VIDEO_TEXTURE)
        texColor.assign(texture2D(muVideoTextures[i], textureCoord));
      else texColor.assign(texture2D(muTextures[i], textureCoord));
      texColor.assignMultiply(muInfluence[i]);
      color.assignAdd(texColor);
    }
  }