Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

package com.gebauz.bauzoid.graphics.model;

/** Helper class for filling geometry arrays. */
public class AttributeArray
{
        private float[] mAttributeArray = null;
        private int mCurrentIndex = 0;

        public AttributeArray(int size)
        {
                mAttributeArray = new float[size];
                mCurrentIndex = 0;
        }
       
        public void fill(float x)
        {
                mAttributeArray[mCurrentIndex] = x; mCurrentIndex++;
        }
       
        public void fill(float x, float y)
        {
                mAttributeArray[mCurrentIndex] = x; mCurrentIndex++;
                mAttributeArray[mCurrentIndex] = y; mCurrentIndex++;
        }
       
        public void fill(float x, float y, float z)
        {
                mAttributeArray[mCurrentIndex] = x; mCurrentIndex++;
                mAttributeArray[mCurrentIndex] = y; mCurrentIndex++;           
                mAttributeArray[mCurrentIndex] = z; mCurrentIndex++;
        }
       
        public void fill(float x, float y, float z, float w)
        {
                mAttributeArray[mCurrentIndex] = x; mCurrentIndex++;
                mAttributeArray[mCurrentIndex] = y; mCurrentIndex++;           
                mAttributeArray[mCurrentIndex] = z; mCurrentIndex++;
                mAttributeArray[mCurrentIndex] = w; mCurrentIndex++;                   
        }
       
        public float[] getAttributeArray()
        {
                return mAttributeArray;
        }
       
        public int getUsedCount()
        {
                return mCurrentIndex;
        }
}