/src/ogre/OgreMain/src/OgreRenderable.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // This file is part of the OGRE project. |
2 | | // It is subject to the license terms in the LICENSE file found in the top-level directory |
3 | | // of this distribution and at https://www.ogre3d.org/licensing. |
4 | | |
5 | | #include "OgreStableHeaders.h" |
6 | | |
7 | | namespace Ogre |
8 | | { |
9 | 0 | void Renderable::setCustomParameter(size_t index, const Vector4f& value) { mCustomParameters[index] = value; } |
10 | | |
11 | 0 | void Renderable::removeCustomParameter(size_t index) { mCustomParameters.erase(index); } |
12 | | |
13 | | bool Renderable::hasCustomParameter(size_t index) const |
14 | 0 | { |
15 | 0 | return mCustomParameters.find(index) != mCustomParameters.end(); |
16 | 0 | } |
17 | | |
18 | | const Vector4f& Renderable::getCustomParameter(size_t index) const |
19 | 0 | { |
20 | 0 | CustomParameterMap::const_iterator i = mCustomParameters.find(index); |
21 | 0 | if (i != mCustomParameters.end()) |
22 | 0 | { |
23 | 0 | return i->second; |
24 | 0 | } |
25 | 0 | else |
26 | 0 | { |
27 | 0 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Parameter at the given index was not found."); |
28 | 0 | } |
29 | 0 | } |
30 | | |
31 | | void Renderable::_updateCustomGpuParameter(const GpuProgramParameters::AutoConstantEntry& constantEntry, |
32 | | GpuProgramParameters* params) const |
33 | 0 | { |
34 | 0 | CustomParameterMap::const_iterator i = mCustomParameters.find(constantEntry.data); |
35 | 0 | if (i != mCustomParameters.end()) |
36 | 0 | { |
37 | 0 | params->_writeRawConstant(constantEntry.physicalIndex, i->second, constantEntry.elementCount); |
38 | 0 | } |
39 | 0 | } |
40 | | } // namespace Ogre |