#include <tile_bank.h>
Nevrax France
Definition at line 224 of file tile_bank.h.
Public Types | |
| enum | TBorder { top = 0, bottom, left, right, borderCount } |
Public Member Functions | |
| CTileBorder () | |
| void | doubleSize () |
| void | get (int &width, int &height, std::vector< NLMISC::CBGRA > &array) const |
| sint32 | getHeight () const |
| sint32 | getWidth () const |
| bool | isSet () const |
| void | operator= (const CTileBorder &border) |
| bool | operator== (const CTileBorder &border) const |
| void | reset () |
| void | rotate () |
| void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| void | set (int width, int height, const std::vector< NLMISC::CBGRA > &array) |
Static Public Member Functions | |
| bool | allAlphaSet (const CTileBorder &border, TBorder where, int &pixel, int &composante) |
| bool | compare (const CTileBorder &border1, const CTileBorder &border2, TBorder where1, TBorder where2, int &pixel, int &composante) |
Private Attributes | |
| std::vector< NLMISC::CBGRA > | _Borders [borderCount] |
| sint32 | _Height |
| bool | _Set |
| sint32 | _Width |
Static Private Attributes | |
| const sint | _Version = 0 |
|
|
Definition at line 227 of file tile_bank.h.
00227 { top=0, bottom, left, right, borderCount };
|
|
|
Definition at line 228 of file tile_bank.h. References reset().
00229 {
00230 reset();
00231 }
|
|
||||||||||||||||||||
|
Definition at line 1731 of file tile_bank.cpp. References border, and nlassert.
01732 {
01733 // Check border is initialized
01734 nlassert (border.isSet());
01735
01736 // always Alpha
01737 composante=3;
01738
01739 for (pixel=0; pixel<(int)border._Borders[where].size(); pixel++)
01740 {
01741 if (border._Borders[where][pixel].A!=0xff)
01742 return false;
01743 }
01744
01745 return true;
01746 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 1696 of file tile_bank.cpp. References _Borders, isSet(), and nlassert.
01697 {
01698 // Check border is initialized
01699 nlassert (border1.isSet());
01700 nlassert (border2.isSet());
01701
01702 if (border1._Borders[where1].size()!=border2._Borders[where2].size())
01703 return false;
01704 for (pixel=0; pixel<(int)border1._Borders[where1].size(); pixel++)
01705 {
01706 if (border1._Borders[where1][pixel].R!=border2._Borders[where2][pixel].R)
01707 {
01708 composante=0;
01709 return false;
01710 }
01711 else if (border1._Borders[where1][pixel].G!=border2._Borders[where2][pixel].G)
01712 {
01713 composante=1;
01714 return false;
01715 }
01716 else if (border1._Borders[where1][pixel].B!=border2._Borders[where2][pixel].B)
01717 {
01718 composante=2;
01719 return false;
01720 }
01721 else if (border1._Borders[where1][pixel].A!=border2._Borders[where2][pixel].A)
01722 {
01723 composante=3;
01724 return false;
01725 }
01726 }
01727
01728 return true;
01729 }
|
|
|
Definition at line 1765 of file tile_bank.cpp. References _Borders, bottom, left, right, top, and w. Referenced by NL3D::CTileSet::checkTile256(), and NL3D::CTileSet::setBorder().
01766 {
01767 _Borders[top].resize (_Width*2);
01768 _Borders[bottom].resize (_Width*2);
01769 _Borders[left].resize (_Height*2);
01770 _Borders[right].resize (_Height*2);
01771
01772 for (int w=0; w<_Width; w++)
01773 {
01774 _Borders[top][w+_Width]=_Borders[top][w];
01775 _Borders[bottom][w+_Width]=_Borders[bottom][w];
01776 }
01777 for (int h=0; h<_Height; h++)
01778 {
01779 _Borders[left][h+_Height]=_Borders[left][h];
01780 _Borders[right][h+_Height]=_Borders[right][h];
01781 }
01782 }
|
|
||||||||||||||||
|
Definition at line 1649 of file tile_bank.cpp. References _Borders, _Set, bottom, height, left, nlassert, right, size, top, uint, w, and width.
01650 {
01651 // Go
01652 if (_Set)
01653 {
01654 width=_Width;
01655 height=_Height;
01656 array.resize (0);
01657 array.resize (_Width*_Height);
01658 nlassert (_Borders[bottom].size()==(uint)_Width);
01659 nlassert (_Borders[top].size()==(uint)_Width);
01660 nlassert (_Borders[left].size()==(uint)_Height);
01661 nlassert (_Borders[right].size()==(uint)_Height);
01662
01663 // Fill
01664 CBGRA black(0,0,0);
01665 for (int p=0; p<_Width*_Height; p++)
01666 {
01667 array[p]=black;
01668 }
01669
01670 // Last line
01671 int lastLine=(_Height-1)*_Width;
01672 int lastCol=(_Width-1);
01673
01674 // Copy top/bottom border
01675 for (int w=0; w<_Width; w++)
01676 {
01677 array[w]=_Borders[top][w];
01678 array[w+lastLine]=_Borders[bottom][w];
01679 }
01680
01681 // Copy left/right border
01682 for (int h=0; h<_Height; h++)
01683 {
01684 array[h*_Width]=_Borders[left][h];
01685 array[h*_Width+lastCol]=_Borders[right][h];
01686 }
01687 }
01688 else
01689 {
01690 width=0;
01691 height=0;
01692 array.resize (0);
01693 }
01694 }
|
|
|
Definition at line 254 of file tile_bank.h. References sint32.
00255 {
00256 return _Height;
00257 }
|
|
|
Definition at line 250 of file tile_bank.h. References sint32.
00251 {
00252 return _Width;
00253 }
|
|
|
Definition at line 238 of file tile_bank.h. References _Set. Referenced by NL3D::CTileSet::checkTile128(), NL3D::CTileSet::checkTile256(), compare(), and NL3D::CTileSet::getExistingTransitionTile().
00239 {
00240 return _Set;
00241 }
|
|
|
Definition at line 1753 of file tile_bank.cpp. References _Borders, _Set, border, bottom, left, right, and top.
|
|
|
Definition at line 1748 of file tile_bank.cpp. References _Borders, and border.
|
|
|
Definition at line 242 of file tile_bank.h. References _Borders, _Set, bottom, left, right, and top. Referenced by NL3D::CTileSet::cleanUnusedData(), NL3D::CTileSet::clearTransition(), CTileBorder(), and NL3D::CTileSet::deleteBordersIfLast().
|
|
|
Definition at line 1784 of file tile_bank.cpp. References _Borders, bottom, left, right, sint32, size, top, and uint.
01785 {
01786 // Copy the right
01787 std::vector<NLMISC::CBGRA> tmpLeft=_Borders[left];
01788
01789 // Top inverted becomes left
01790 uint i, size;
01791 size=_Borders[top].size();
01792 _Borders[left].resize (size);
01793
01794 // copy inverted
01795 for (i=0; i<size; i++)
01796 _Borders[left][i]=_Borders[top][size-i-1];
01797
01798 // Right become top
01799 _Borders[top]=_Borders[right];
01800
01801 // bottom inverted becomes right
01802 size=_Borders[bottom].size();
01803 _Borders[right].resize (size);
01804
01805 // copy inverted
01806 for (i=0; i<size; i++)
01807 _Borders[right][i]=_Borders[bottom][size-i-1];
01808
01809 // Left become bottom
01810 _Borders[bottom]=tmpLeft;
01811
01812 // Invert size
01813 sint32 tmpSize=_Width;
01814 _Width=_Height;
01815 _Height=tmpSize;
01816 }
|
|
|
Definition at line 1599 of file tile_bank.cpp. Referenced by NL3D::CTileSet::serial().
01600 {
01601 (void)f.serialVersion(_Version);
01602
01603 f.serial (_Set);
01604 f.serial (_Width);
01605 f.serial (_Height);
01606 f.serialCont (_Borders[top]);
01607 f.serialCont (_Borders[bottom]);
01608 f.serialCont (_Borders[left]);
01609 f.serialCont (_Borders[right]);
01610 }
|
|
||||||||||||||||
|
Definition at line 1612 of file tile_bank.cpp. References _Borders, _Set, bottom, height, left, nlassert, right, sint, top, w, and width.
01613 {
01614 // Check array size
01615 nlassert (width>0);
01616 nlassert (height>0);
01617 nlassert ((sint)array.size()==width*height);
01618
01619 // Copy size
01620 _Width=width;
01621 _Height=height;
01622
01623 // Last line
01624 int lastLine=(_Height-1)*width;
01625 int lastCol=(_Width-1);
01626 _Borders[top].resize (_Width);
01627 _Borders[bottom].resize (_Width);
01628 _Borders[left].resize (_Height);
01629 _Borders[right].resize (_Height);
01630
01631 // Copy top/bottom border
01632 for (int w=0; w<_Width; w++)
01633 {
01634 _Borders[top][w]=array[w];
01635 _Borders[bottom][w]=array[w+lastLine];
01636 }
01637
01638 // Copy left/right border
01639 for (int h=0; h<_Height; h++)
01640 {
01641 _Borders[left][h]=array[h*_Width];
01642 _Borders[right][h]=array[h*_Width+lastCol];
01643 }
01644
01645 // Set
01646 _Set=true;
01647 }
|
|
|
Definition at line 267 of file tile_bank.h. Referenced by compare(), doubleSize(), get(), operator=(), operator==(), reset(), rotate(), and set(). |
|
|
Definition at line 266 of file tile_bank.h. |
|
|
Definition at line 264 of file tile_bank.h. Referenced by get(), isSet(), operator=(), reset(), and set(). |
|
|
Definition at line 1597 of file tile_bank.cpp. |
|
|
Definition at line 265 of file tile_bank.h. |
1.3.6