From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a06520.html | 245 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 docs/doxygen/nel/a06520.html (limited to 'docs/doxygen/nel/a06520.html') diff --git a/docs/doxygen/nel/a06520.html b/docs/doxygen/nel/a06520.html new file mode 100644 index 00000000..94cbb23f --- /dev/null +++ b/docs/doxygen/nel/a06520.html @@ -0,0 +1,245 @@ + + +NeL: texture_far.h Source File + + + +
+

texture_far.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_TEXTURE_FAR_H
+00027 #define NL_TEXTURE_FAR_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/misc/rect.h"
+00031 #include "3d/texture.h"
+00032 #include "3d/tile_far_bank.h"
+00033 
+00034 /* NB: those Values work only if NL_MAX_TILES_BY_PATCH_EDGE is 16.
+00035         asserted in the cpp.
+00036         Else must change NL_MAX_FAR_PATCH_EDGE, NL_NUM_FAR_PATCH_EDGE_LEVEL, and NL_NUM_FAR_RECTANGLE_RATIO
+00037 */
+00038 
+00039 // The number of different Level to allocate. only possible to allocate 16, 8, 4 or 2 tiles patch (1x? is impossible)
+00040 #define NL_NUM_FAR_PATCH_EDGE_LEVEL             (4+NL_NUM_PIXELS_ON_FAR_TILE_EDGE_SHIFT)
+00041 
+00042 // Define the max number of pixel per edge for a far texture 
+00043 #define NL_MAX_FAR_PATCH_EDGE (16*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)                                       // Max is 16x16 tiles for 4 pix/tiles.
+00044 
+00045 // Define the min number of pixel per edge for a far texture 
+00046 #define NL_MIN_FAR_PATCH_EDGE 2                                                                                                         // Min is 2x2 tiles for 1 pix/tile
+00047 
+00048 // The max Difference of level between Height and Width
+00049 #define NL_NUM_FAR_RECTANGLE_RATIO      4                                                                                               // 16x16, 16x8, 16x4, 16x2
+00050 #define NL_MAX_FAR_RECTANGLE_RATIO_SHIFT        (NL_NUM_RECTANGLE_ASPECT_RATIO-1)
+00051 #define NL_MAX_FAR_RECTANGLE_RATIO      (1<<NL_MAX_RECTANGLE_RATIO_SHIFT)                               // Max is 16 tiles fo 2 tiles => 8.
+00052 
+00053 // The number of Square of MaxFarEdge.
+00054 #define NL_NUM_FAR_BIGGEST_PATCH_PER_EDGE                       8
+00055 #define NL_NUM_FAR_BIGGEST_PATCH_PER_TEXTURE            (NL_NUM_FAR_BIGGEST_PATCH_PER_EDGE*NL_NUM_FAR_BIGGEST_PATCH_PER_EDGE)
+00056 
+00057 // The size of the texture.  8*64 => textureFar of 512*512.
+00058 #define NL_FAR_TEXTURE_EDGE_SIZE                                        (NL_MAX_FAR_PATCH_EDGE*NL_NUM_FAR_BIGGEST_PATCH_PER_EDGE)
+00059 
+00060 
+00061 namespace NLMISC
+00062 {
+00063         class CRGBA;
+00064 }
+00065 
+00066 namespace NL3D 
+00067 {
+00068 
+00069 class CPatch;
+00070 class CTileFarBank;
+00071 class CTileColor;
+00072 
+00085 class CTextureFar : public ITexture
+00086 {
+00087 public:
+00089         CTextureFar();
+00090         virtual ~CTextureFar();
+00091 
+00092 
+00098         sint                                            tryAllocatePatch (CPatch *pPatch, uint farIndex);
+00099 
+00100 
+00111         void                                            allocatePatch (CPatch *pPatch, uint farIndex, float& farUScale, float& farVScale, float& farUBias, float& farVBias, bool& bRot);
+00112 
+00116         void                                            removePatch (CPatch *pPatch, uint farIndex);
+00117 
+00123         virtual void                            doGenerate(bool async = false);
+00124 
+00129         uint                                            touchPatchULAndNext();
+00130         void                                            startPatchULTouch();
+00131         bool                                            endPatchULTouch() const;
+00132 
+00133 
+00135         void                                            linkBeforeUL(CTextureFar *textNext);
+00137         void                                            unlinkUL();
+00139         CTextureFar                                     *getNextUL() const {return _ULNext;}
+00140 
+00141 
+00143         CTileFarBank*                           _Bank;
+00144 
+00145 
+00146 private:
+00147 
+00148         struct  CPatchIdent
+00149         {
+00150                 CPatch  *Patch;
+00151                 uint    FarIndex;
+00152 
+00153                 bool operator < (const CPatchIdent &rhs) const
+00154                 {
+00155                         return (Patch != rhs.Patch) ? Patch < rhs.Patch : FarIndex < rhs.FarIndex;      
+00156                 }
+00157         };
+00158 
+00159         struct  CVector2s
+00160         {
+00161                 uint16  x, y;
+00162 
+00163                 CVector2s() {}
+00164                 CVector2s(uint16 _x, uint16 _y) {x= _x; y= _y;}
+00165 
+00166                 bool operator < (const CVector2s &rhs) const
+00167                 {
+00168                         return (x != rhs.x) ? x < rhs.x : y < rhs.y;    
+00169                 }
+00170         };
+00171 
+00176         typedef std::map<CPatchIdent, CVector2s>        TPatchToPosMap;
+00177         typedef std::map<CVector2s, CPatchIdent>        TPosToPatchMap;
+00178         TPatchToPosMap                                          _PatchToPosMap;
+00179         TPosToPatchMap                                          _PosToPatchMap;
+00180 
+00183         std::list<CVector2s>                            _FreeSpaces[NL_NUM_FAR_PATCH_EDGE_LEVEL * NL_NUM_FAR_RECTANGLE_RATIO];
+00184 
+00185 
+00186         // allocate search
+00187         bool    getUpperSize(uint &width, uint &height);
+00188         uint    getFreeListId(uint width, uint height);
+00189         void    recursSplitNext(uint width, uint height);
+00190 
+00194         void rebuildPatch  (const CVector2s texturePos, const CPatchIdent &pid);
+00195 
+00197         virtual void    serial(NLMISC::IStream &f) throw(NLMISC::EStream) {};
+00198 
+00199         // Some static buffers
+00200         static NLMISC::CRGBA    _LightmapExpanded[];
+00201         static uint8                    _LumelExpanded[];
+00202         static NLMISC::CRGBA    _TileTLIColors[];
+00203 
+00204         NLMISC_DECLARE_CLASS(CTextureFar);
+00205 
+00207         CTextureFar                                     *_ULPrec;
+00208         CTextureFar                                     *_ULNext;
+00209         // Iterator to the next patch to update.
+00210         TPatchToPosMap::iterator        _ItULPatch;
+00211 
+00212 };
+00213 
+00214 } // NL3D
+00215 
+00216 // For NL3D_drawFarTileInFarTexture external call
+00217 struct NL3D_CComputeTileFar
+00218 {
+00219 public:
+00220         // TileFar pixels
+00221         const NLMISC::CRGBA*            SrcDiffusePixels;
+00222 
+00223         // TileFar pixels
+00224         const NLMISC::CRGBA*            SrcAdditivePixels;
+00225 
+00226         // Source deltaY
+00227         sint32                                          SrcDeltaX;
+00228 
+00229         // Source deltaY
+00230         sint32                                          SrcDeltaY;
+00231 
+00232         // Source lighting
+00233         const NLMISC::CRGBA*            SrcLightingPixels;
+00234 
+00235         // Delta Y for lighting
+00236         sint32                                          SrcLightingDeltaY;
+00237 
+00238         // TileFar pixels
+00239         NLMISC::CRGBA*                          DstPixels;
+00240 
+00241         // Destination deltaX
+00242         sint32                                          DstDeltaX;
+00243 
+00244         // Destination deltaY
+00245         sint32                                          DstDeltaY;
+00246 
+00247         // Size
+00248         sint32                                          Size;
+00249 
+00250         // Can the compute be done in MMX
+00251         bool                                            AsmMMX;
+00252 };
+00253 
+00254 // For NL3D_expandLightmap external call
+00255 struct NL3D_CExpandLightmap
+00256 {
+00257 public:
+00258         // CTileColor array.
+00259         const NL3D::CTileColor*         ColorTile;
+00260         // TLI Color array.
+00261         const NLMISC::CRGBA*            TLIColor;
+00262 
+00263         // Lumel array. 4x4 lumels by tile.
+00264         const uint8*                            LumelTile;
+00265 
+00266         // Width of the array
+00267         uint32                                          Width;
+00268 
+00269         // Height of the array
+00270         uint32                                          Height;
+00271 
+00272         // Mul factor for the size (1, 2 or 4)
+00273         uint32                                          MulFactor;
+00274 
+00275         // Static light color
+00276         const NLMISC::CRGBA*            StaticLightColor;
+00277 
+00278         // Destination array
+00279         NLMISC::CRGBA*                          DstPixels;
+00280 };
+00281         
+00282 // Extern ASM functions
+00283 extern "C" void NL3D_expandLightmap (const NL3D_CExpandLightmap* pLightmap);
+00284 extern "C" void NL3D_drawFarTileInFarTexture (const NL3D_CComputeTileFar* pTileFar);
+00285 extern "C" void NL3D_drawFarTileInFarTextureAdditive (const NL3D_CComputeTileFar* pTileFar);
+00286 extern "C" void NL3D_drawFarTileInFarTextureAlpha (const NL3D_CComputeTileFar* pTileFar);
+00287 extern "C" void NL3D_drawFarTileInFarTextureAdditiveAlpha (const NL3D_CComputeTileFar* pTileFar);
+00288 
+00289 #endif // NL_TEXTURE_FAR_H
+00290 
+00291 /* End of texture_far.h */
+

Generated on Tue Mar 16 06:40:43 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1