VoxelStencil.Apply C# (CSharp) Method

Apply() public method

public Apply ( int x, int y, bool voxel ) : bool
x int
y int
voxel bool
return bool
	public virtual bool Apply (int x, int y, bool voxel) {
		return fillType;
	}
}

Usage Example

    public void Apply(VoxelStencil stencil)
    {
        int xStart = stencil.XStart;
        int xEnd = stencil.XEnd;
        int yStart = stencil.YStart;
        int yEnd = stencil.YEnd;

        if (xStart < 0)
        {
            xStart = 0;
        }
        if (xEnd >= m_resolution)
        {
            xEnd = m_resolution - 1;
        }
        if (yStart < 0)
        {
            yStart = 0;
        }
        if (yEnd >= m_resolution)
        {
            yEnd = m_resolution - 1;
        }

        for (int y = yStart; y <= yEnd; y++)
        {
            int i = y * m_resolution + xStart;
            for (int x = xStart; x <= xEnd; x++, i++)
            {
                m_voxels[i].m_state = stencil.Apply(x, y, m_voxels[i].m_state);
            }
        }

        Refresh();
    }
All Usage Examples Of VoxelStencil::Apply