Exemplo n.º 1
0
 public AsQuad(float width, float height, uint color, bool premultipliedAlpha)
 {
     mTinted     = color != 0xffffff;
     mVertexData = new AsVertexData(4, premultipliedAlpha);
     mVertexData.setPosition(0, 0.0f, 0.0f);
     mVertexData.setPosition(1, width, 0.0f);
     mVertexData.setPosition(2, 0.0f, height);
     mVertexData.setPosition(3, width, height);
     mVertexData.setUniformColor(color);
     onVertexDataChanged();
 }
 private void updateBuffers(AsContext3D context, AsRectangle bounds)
 {
     mVertexData.setPosition(0, bounds.x, bounds.y);
     mVertexData.setPosition(1, bounds.getRight(), bounds.y);
     mVertexData.setPosition(2, bounds.x, bounds.getBottom());
     mVertexData.setPosition(3, bounds.getRight(), bounds.getBottom());
     if (mVertexBuffer == null)
     {
         mVertexBuffer = context.createVertexBuffer(4, AsVertexData.ELEMENTS_PER_VERTEX);
         mIndexBuffer  = context.createIndexBuffer(6);
         mIndexBuffer.uploadFromVector(mIndexData, 0, 6);
     }
     mVertexBuffer.uploadFromVector(mVertexData.getRawData(), 0, 4);
 }