Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / src / 3d / program.cpp
bloba1c0f69cb5186b5cc1af57d1ccf4dcb8c44ef514
1 /**
2 * \file program.cpp
3 * \brief IProgram
4 * \date 2013-09-07 15:00GMT
5 * \author Jan Boon (Kaetemi)
6 * IProgram
7 */
9 // NeL - MMORPG Framework <https://wiki.ryzom.dev/>
10 // Copyright (C) 2013-2014 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
12 // This program is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU Affero General Public License as
14 // published by the Free Software Foundation, either version 3 of the
15 // License, or (at your option) any later version.
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Affero General Public License for more details.
22 // You should have received a copy of the GNU Affero General Public License
23 // along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "std3d.h"
27 #include "nel/misc/types_nl.h"
28 #include "nel/3d/program.h"
30 // STL includes
32 // NeL includes
33 // #include <nel/misc/debug.h>
34 #include "nel/misc/string_mapper.h"
36 // Project includes
37 #include "nel/3d/driver.h"
39 using namespace std;
40 // using namespace NLMISC;
42 #ifdef DEBUG_NEW
43 #define new DEBUG_NEW
44 #endif
46 namespace NL3D {
48 // ***************************************************************************
50 IProgramDrvInfos::IProgramDrvInfos(IDriver *drv, ItGPUPrgDrvInfoPtrList it)
52 _Driver = drv;
53 _DriverIterator = it;
56 // ***************************************************************************
58 IProgramDrvInfos::~IProgramDrvInfos ()
60 _Driver->removeGPUPrgDrvInfoPtr(_DriverIterator);
63 // ***************************************************************************
65 IProgram::IProgram()
70 // ***************************************************************************
72 IProgram::~IProgram()
74 // Must kill the drv mirror of this program.
75 m_DrvInfo.kill();
78 const char *CProgramIndex::Names[NUM_UNIFORMS] =
80 "modelView",
81 "modelViewInverse",
82 "modelViewTranspose",
83 "modelViewInverseTranspose",
85 "projection",
86 "projectionInverse",
87 "projectionTranspose",
88 "projectionInverseTranspose",
90 "modelViewProjection",
91 "modelViewProjectionInverse",
92 "modelViewProjectionTranspose",
93 "modelViewProjectionInverseTranspose",
95 "fog",
98 void IProgram::buildInfo(CSource *source)
100 // nlassert(!m_Source); // VALID: When deleting driver and creating new one.
102 m_Source = source;
104 // Fill index cache
105 for (int i = 0; i < CProgramIndex::NUM_UNIFORMS; ++i)
107 m_Index.Indices[i] = getUniformIndex(m_Index.Names[i]);
110 buildInfo();
113 void IProgram::buildInfo()
118 } /* namespace NL3D */
120 /* end of file */