Ejemplo n.º 1
0
        //splatting only
        public int newSplatLayer(int activeTextureIndex)
        {
            if (mLayers.Count > 0 &&
                mLayers[mLayers.Count - 1].mActiveTextureIndex == activeTextureIndex &&
                mLayers[mLayers.Count - 1].mLayerType == BTerrainTexturingLayer.eLayerType.cLayer_Splat)
            {
                return(mLayers.Count - 1);
            }

            BTerrainPerVertexLayerData vld = new BTerrainPerVertexLayerData();

            vld.mLayerType          = BTerrainTexturingLayer.eLayerType.cLayer_Splat;
            vld.mActiveTextureIndex = activeTextureIndex;
            vld.mAlphaContrib       = 0;

            //find where we should be inserted
            for (int i = 0; i < mLayers.Count; i++)
            {
                if (mLayers[i].mActiveTextureIndex > activeTextureIndex)
                {
                    mLayers.Insert(i, vld);
                    return(i);
                }
            }

            //we didn't find a spot.
            mLayers.Add(vld);

            return(mLayers.Count - 1);
        }
Ejemplo n.º 2
0
 public void copyTo(BTerrainTextureVector target)
 {
     target.mLayers.Clear();
     for (int i = 0; i < mLayers.Count; i++)
     {
         BTerrainPerVertexLayerData vld = new BTerrainPerVertexLayerData();
         vld.mActiveTextureIndex = mLayers[i].mActiveTextureIndex;
         vld.mAlphaContrib       = mLayers[i].mAlphaContrib;
         vld.mLayerType          = mLayers[i].mLayerType;
         target.mLayers.Add(vld);
     }
 }
Ejemplo n.º 3
0
        //decals
        public int newDecalLayer(int activeDecalInstanceIndex)
        {
            if (mLayers.Count > 0 &&
                mLayers[mLayers.Count - 1].mActiveTextureIndex == activeDecalInstanceIndex &&
                mLayers[mLayers.Count - 1].mLayerType == BTerrainTexturingLayer.eLayerType.cLayer_Decal)
            {
                return(mLayers.Count - 1);
            }

            BTerrainPerVertexLayerData vld = new BTerrainPerVertexLayerData();

            vld.mLayerType          = BTerrainTexturingLayer.eLayerType.cLayer_Decal;
            vld.mActiveTextureIndex = activeDecalInstanceIndex;
            vld.mAlphaContrib       = 255;

            mLayers.Add(vld);

            return(mLayers.Count - 1);
        }
Ejemplo n.º 4
0
        //used for clipart
        public BTerrainTextureVector giveLayerChainAtPixel(int x, int z)
        {
            BTerrainTextureVector v = new BTerrainTextureVector();

            if (x < 0 || z < 0 || x >= BTerrainTexturing.getAlphaTextureWidth() || z >= BTerrainTexturing.getAlphaTextureHeight())
            {
                return(v);
            }

            for (int i = 0; i < mLayers.Count; i++)
            {
                BTerrainPerVertexLayerData layer = new BTerrainPerVertexLayerData();
                layer.mActiveTextureIndex = mLayers[i].mActiveTextureIndex;
                layer.mLayerType          = mLayers[i].mLayerType;
                layer.mAlphaContrib       = mLayers[i].mAlphaLayer[x + BTerrainTexturing.getAlphaTextureWidth() * z];
                v.mLayers.Add(layer);
            }

            return(v);
        }