Coverage Report

Created: 2026-01-09 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ogre/OgreMain/include/OgreBillboardParticleRenderer.h
Line
Count
Source
1
/*
2
-----------------------------------------------------------------------------
3
This source file is part of OGRE
4
(Object-oriented Graphics Rendering Engine)
5
For the latest info, see http://www.ogre3d.org/
6
7
Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9
Permission is hereby granted, free of charge, to any person obtaining a copy
10
of this software and associated documentation files (the "Software"), to deal
11
in the Software without restriction, including without limitation the rights
12
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
copies of the Software, and to permit persons to whom the Software is
14
furnished to do so, subject to the following conditions:
15
16
The above copyright notice and this permission notice shall be included in
17
all copies or substantial portions of the Software.
18
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
THE SOFTWARE.
26
-----------------------------------------------------------------------------
27
*/
28
#ifndef __BillboardParticleRenderer_H__
29
#define __BillboardParticleRenderer_H__
30
31
#include "OgrePrerequisites.h"
32
#include "OgreParticleSystemRenderer.h"
33
#include "OgreBillboardSet.h"
34
#include "OgreHeaderPrefix.h"
35
36
namespace Ogre {
37
38
    /** \addtogroup Core
39
    *  @{
40
    */
41
    /** \addtogroup Effects
42
    *  @{
43
    */
44
45
    /** Specialisation of ParticleSystemRenderer to render particles using 
46
        a BillboardSet. 
47
48
        This renderer has a few more options than the standard particle system,
49
        which will be passed to it automatically when the particle system itself
50
        does not understand them.
51
    */
52
    class _OgreExport BillboardParticleRenderer : public ParticleSystemRenderer
53
    {
54
        /// The billboard set that's doing the rendering
55
        BillboardSet* mBillboardSet;
56
        Vector2 mStacksSlices;
57
    public:
58
        BillboardParticleRenderer();
59
        ~BillboardParticleRenderer();
60
61
        /// @copydoc BillboardSet::setTextureStacksAndSlices
62
        void setTextureStacksAndSlices(uchar stacks, uchar slices)
63
0
        {
64
0
            mStacksSlices = Vector2(stacks, slices); // cache for get call
65
0
            mBillboardSet->setTextureStacksAndSlices(stacks, slices);
66
0
        }
67
68
0
        const Vector2& getTextureStacksAndSlices() const { return mStacksSlices; }
69
70
        /// @copydoc BillboardSet::setBillboardType
71
0
        void setBillboardType(BillboardType bbt) { mBillboardSet->setBillboardType(bbt); }
72
        /// @copydoc BillboardSet::getBillboardType
73
0
        BillboardType getBillboardType(void) const { return mBillboardSet->getBillboardType(); }
74
        /// @copydoc BillboardSet::setUseAccurateFacing
75
0
        void setUseAccurateFacing(bool acc) { mBillboardSet->setUseAccurateFacing(acc); }
76
        /// @copydoc BillboardSet::getUseAccurateFacing
77
0
        bool getUseAccurateFacing(void) const { return mBillboardSet->getUseAccurateFacing(); }
78
        /// @copydoc BillboardSet::setBillboardOrigin
79
0
        void setBillboardOrigin(BillboardOrigin origin) { mBillboardSet->setBillboardOrigin(origin); }
80
        /// @copydoc BillboardSet::getBillboardOrigin
81
0
        BillboardOrigin getBillboardOrigin(void) const { return mBillboardSet->getBillboardOrigin(); }
82
        /// @copydoc BillboardSet::setBillboardRotationType
83
        void setBillboardRotationType(BillboardRotationType rotationType)
84
0
        {
85
0
            mBillboardSet->setBillboardRotationType(rotationType);
86
0
        }
87
        /// @copydoc BillboardSet::getBillboardRotationType
88
        BillboardRotationType getBillboardRotationType() const
89
0
        {
90
0
            return mBillboardSet->getBillboardRotationType();
91
0
        }
92
        /// @copydoc BillboardSet::setCommonDirection
93
0
        void setCommonDirection(const Vector3& vec) { mBillboardSet->setCommonDirection(vec); }
94
        /// @copydoc BillboardSet::getCommonDirection
95
0
        const Vector3& getCommonDirection(void) const { return mBillboardSet->getCommonDirection(); }
96
        /// @copydoc BillboardSet::setCommonUpVector
97
0
        void setCommonUpVector(const Vector3& vec) { mBillboardSet->setCommonUpVector(vec); }
98
        /// @copydoc BillboardSet::getCommonUpVector
99
0
        const Vector3& getCommonUpVector(void) const { return mBillboardSet->getCommonUpVector(); }
100
        /// @copydoc BillboardSet::setPointRenderingEnabled
101
0
        void setPointRenderingEnabled(bool enabled) { mBillboardSet->setPointRenderingEnabled(enabled); }
102
        /// @copydoc BillboardSet::isPointRenderingEnabled
103
0
        bool isPointRenderingEnabled(void) const { return mBillboardSet->isPointRenderingEnabled(); }
104
105
        /// @copydoc ParticleSystemRenderer::getType
106
        const String& getType(void) const override;
107
        /// @copydoc ParticleSystemRenderer::_updateRenderQueue
108
        void _updateRenderQueue(RenderQueue* queue, 
109
            std::vector<Particle*>& currentParticles, bool cullIndividually) override;
110
        /// @copydoc ParticleSystemRenderer::visitRenderables
111
        void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables = false) override
112
0
        {
113
0
            mBillboardSet->visitRenderables(visitor, debugRenderables);
114
0
        }
115
0
        void _setMaterial(MaterialPtr& mat) override { mBillboardSet->setMaterial(mat); }
116
        /// @copydoc ParticleSystemRenderer::_notifyCurrentCamera
117
0
        void _notifyCurrentCamera(Camera* cam) override { mBillboardSet->_notifyCurrentCamera(cam); }
118
        /// @copydoc ParticleSystemRenderer::_notifyParticleQuota
119
0
        void _notifyParticleQuota(size_t quota) override { mBillboardSet->setPoolSize(quota); }
120
        /// @copydoc ParticleSystemRenderer::_notifyAttached
121
        void _notifyAttached(Node* parent, bool isTagPoint = false) override
122
0
        {
123
0
            mBillboardSet->_notifyAttached(parent, isTagPoint);
124
0
        }
125
        /// @copydoc ParticleSystemRenderer::_notifyDefaultDimensions
126
        void _notifyDefaultDimensions(Real width, Real height) override
127
0
        {
128
0
            mBillboardSet->setDefaultDimensions(width, height);
129
0
        }
130
        /// @copydoc ParticleSystemRenderer::setRenderQueueGroup
131
0
        void setRenderQueueGroup(uint8 queueID) override { mBillboardSet->setRenderQueueGroup(queueID); }
132
        /// @copydoc MovableObject::setRenderQueueGroupAndPriority
133
        void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority) override
134
0
        {
135
0
            mBillboardSet->setRenderQueueGroupAndPriority(queueID, priority);
136
0
        }
137
        /// @copydoc ParticleSystemRenderer::setKeepParticlesInLocalSpace
138
        void setKeepParticlesInLocalSpace(bool keepLocal) override
139
0
        {
140
0
            mBillboardSet->setBillboardsInWorldSpace(!keepLocal);
141
0
        }
142
        /// @copydoc ParticleSystemRenderer::_getSortMode
143
0
        SortMode _getSortMode(void) const override { return mBillboardSet->_getSortMode(); }
144
145
        /// Access BillboardSet in use
146
0
        BillboardSet* getBillboardSet(void) const { return mBillboardSet; }
147
148
        void _notifyBoundingBox(const AxisAlignedBox& aabb) override;
149
150
0
        void _notifyCastShadows(bool enabled) override { mBillboardSet->setCastShadows(enabled); }
151
    };
152
153
    /** Factory class for BillboardParticleRenderer */
154
    class _OgreExport BillboardParticleRendererFactory : public ParticleSystemRendererFactory
155
    {
156
    public:
157
        /// @copydoc FactoryObj::getType
158
        const String& getType() const override;
159
        /// @copydoc FactoryObj::createInstance
160
        ParticleSystemRenderer* createInstance( const String& name ) override;
161
    };
162
    /** @} */
163
    /** @} */
164
165
} // namespace Ogre
166
167
#include "OgreHeaderSuffix.h"
168
169
#endif // __BillboardParticleRenderer_H__
170