1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "nel/3d/particle_system_process.h"
20 #include "nel/3d/particle_system.h"
26 uint PSEnterLeaveDepth
= 0;
27 uint PSEnterLeaveMaxDepth
= 1;
28 std::string PSCurrName
;
30 // ***********************************************************************************************************
31 CPSEnterLeave::CPSEnterLeave(const char *name
)
35 if (PSEnterLeaveDepth
<= PSEnterLeaveMaxDepth
)
37 std::string
indent(PSEnterLeaveDepth
, ' ');
38 nlinfo("Entering %s in %s", (indent
+ Name
).c_str(), PSCurrName
.c_str());
42 // ***********************************************************************************************************
43 CPSEnterLeave::~CPSEnterLeave()
45 if (PSEnterLeaveDepth
<= PSEnterLeaveMaxDepth
)
47 std::string
indent(PSEnterLeaveDepth
, ' ');
48 nlinfo("Leaving %s in %s", Name
.c_str(), PSCurrName
.c_str());
57 /////////////////////////////////////////////
58 // CParticleSystemProcess implementation //
59 /////////////////////////////////////////////
61 // ***********************************************************************************************************
62 void CParticleSystemProcess::setOwner(CParticleSystem
*ps
)
64 NL_PS_FUNC(CParticleSystemProcess_setOwner
)
65 if (ps
== _Owner
) return;
70 if (_Owner
) _Owner
->releaseRefForUserSysCoordInfo(getUserMatrixUsageCount());
72 if (_Owner
) _Owner
->addRefForUserSysCoordInfo(getUserMatrixUsageCount());
76 // ***********************************************************************************************************
77 uint
CParticleSystemProcess::getUserMatrixUsageCount() const
79 NL_PS_FUNC(CParticleSystemProcess_getUserMatrixUsageCount
)
80 return _MatrixMode
== PSUserMatrix
;
83 // ***********************************************************************************************************
84 void CParticleSystemProcess::setMatrixMode(TPSMatrixMode matrixMode
)
86 NL_PS_FUNC(CParticleSystemProcess_setMatrixMode
)
87 nlassert((uint
) matrixMode
<= PSMatrixModeCount
);
88 if (matrixMode
== _MatrixMode
) return;
89 if (_Owner
) // notify the system that matrix mode has changed for that object
91 _Owner
->matrixModeChanged(this, _MatrixMode
, matrixMode
);
93 _MatrixMode
= matrixMode
;
97 // ***********************************************************************************************************
98 CFontGenerator
*CParticleSystemProcess::getFontGenerator(void)
100 NL_PS_FUNC(CParticleSystemProcess_getFontGenerator
)
102 return _Owner
->getFontGenerator();
105 // ***********************************************************************************************************
106 const CFontGenerator
*CParticleSystemProcess::getFontGenerator(void) const
108 NL_PS_FUNC(CParticleSystemProcess_getFontGenerator
)
110 return _Owner
->getFontGenerator();
113 // ***********************************************************************************************************
114 CFontManager
*CParticleSystemProcess::getFontManager(void)
116 NL_PS_FUNC(CParticleSystemProcess_getFontManager
)
118 return _Owner
->getFontManager();
121 // ***********************************************************************************************************
122 const CFontManager
*CParticleSystemProcess::getFontManager(void) const
124 NL_PS_FUNC(CParticleSystemProcess_getFontManager
)
126 return _Owner
->getFontManager();
131 // ***********************************************************************************************************
132 void CParticleSystemProcess::serial(NLMISC::IStream
&f
)
134 NL_PS_FUNC(CParticleSystemProcess_serial
)
135 // version 2 : added matrix mode (just not fx world matrix or identity)
136 // version 1 : base version
137 sint ver
= f
.serialVersion(2);
141 nlassert(f
.isReading());
142 bool usesFXWorldMatrix
;
143 f
.serial(usesFXWorldMatrix
);
144 _MatrixMode
= usesFXWorldMatrix
? PSFXWorldMatrix
: PSIdentityMatrix
;
148 f
.serialEnum(_MatrixMode
);