zone_symmetrisation.h

Go to the documentation of this file.
00001 
00005 /* Copyright, 2000-2002 Nevrax Ltd.
00006  *
00007  * This file is part of NEVRAX NEL.
00008  * NEVRAX NEL is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2, or (at your option)
00011  * any later version.
00012 
00013  * NEVRAX NEL is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * General Public License for more details.
00017 
00018  * You should have received a copy of the GNU General Public License
00019  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00021  * MA 02111-1307, USA.
00022  */
00023 
00024 #ifndef NL_ZONE_SYMMETRISATION_H
00025 #define NL_ZONE_SYMMETRISATION_H
00026 
00027 #include "nel/misc/types_nl.h"
00028 #include "nel/3d/patchuv_locator.h"
00029 #include "nel/3d/patch.h"
00030 
00031 
00032 namespace NL3D
00033 {
00034 
00035 struct CPatchInfo;
00036 class CTileBank;
00037 
00052 class CZoneSymmetrisation
00053 {
00054 public:
00055 
00057     enum TState
00058     {
00059         Nothing     =0,
00060         Regular     =1,
00061         Goofy       =2,
00062     };
00063 
00065     class CError
00066     {
00067     public:
00068         std::vector<std::string>    Errors;
00069     };
00070 
00072     CZoneSymmetrisation ();
00073 
00078     TState getTileState (uint patch, uint tile, uint layer) const;
00079 
00084     TState getTileBorderState (uint patch, uint tile) const;
00085 
00090     TState getOrientedTileBorderState (uint patch, uint tile) const;
00091 
00095     bool getOrientedTileCorner (uint patch, uint tile);
00096 
00107     bool build (const std::vector<CPatchInfo> &patchInfo, float snapCell, float weldThreshold, const CTileBank &bank, CError &errorDesc, const NLMISC::CMatrix &toOriginalSpace);
00108 
00109 private:
00110 
00122     bool propagateTileState (uint i, uint s, uint t, const std::vector<CPatchInfo> &patchInfo, const CTileBank &bank, bool forceRegular);
00123 
00127     void setTileState (uint patch, uint tile, uint layer, TState state);
00128 
00132     void setTileBorderState (uint patch, uint tile, TState state);
00133 
00137     void setOrientedTileBorderState (uint patch, uint tile, TState state);
00138 
00142     void setOrientedTileCorner (uint patch, uint tile, bool corner);
00143 
00147     bool setTileState (const NL3D::CPatchInfo &patch, uint patchId, float snapCell, float weldThreshold, TState &state, const NLMISC::CMatrix &toOriginalSpace, const CTileBank &bank);
00148     bool setOrientedTileState (const NL3D::CPatchInfo &patch, uint patchId, float snapCell, float weldThreshold, TState &state, const NLMISC::CMatrix &toOriginalSpace, const CTileBank &bank);
00149 
00150     // Snap a position on the grid
00151     static bool snapOnGrid (float& value, float resolution, float snap);
00152 
00153 private:
00154 
00155     // The patch state array
00156     std::vector<std::vector<uint16> >   _TilesLayerStates;
00157 };
00158 
00159 
00160 } // NL3D
00161 
00162 
00163 #endif // NL_ZONE_SYMMETRISATION_H
00164 
00165 /* End of zone_symmetrisation.h */

Generated on Thu Jan 7 08:26:22 2010 for NeL by  doxygen 1.6.1