2022-01-19 18:28:47 +01:00
|
|
|
/* Copyright (C) 2022 Wildfire Games.
|
2023-12-03 01:30:12 +01:00
|
|
|
* This file is part of 0 A.D.
|
2011-04-03 21:15:15 +02:00
|
|
|
*
|
2023-12-03 01:30:12 +01:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2011-04-03 21:15:15 +02:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2023-12-03 01:30:12 +01:00
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
2011-04-03 21:15:15 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2023-12-03 01:30:12 +01:00
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
2011-04-03 21:15:15 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_PARTICLERENDERER
|
|
|
|
#define INCLUDED_PARTICLERENDERER
|
|
|
|
|
2022-05-09 00:02:46 +02:00
|
|
|
#include "renderer/backend/IDeviceCommandContext.h"
|
2022-01-19 18:28:47 +01:00
|
|
|
|
2011-04-03 22:45:43 +02:00
|
|
|
class CParticleEmitter;
|
2014-07-03 00:36:45 +02:00
|
|
|
class CShaderDefines;
|
2011-04-03 21:15:15 +02:00
|
|
|
struct ParticleRendererInternals;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render particles.
|
|
|
|
*/
|
|
|
|
class ParticleRenderer
|
|
|
|
{
|
2013-05-22 23:40:56 +02:00
|
|
|
NONCOPYABLE(ParticleRenderer);
|
|
|
|
|
2011-04-03 21:15:15 +02:00
|
|
|
public:
|
|
|
|
ParticleRenderer();
|
|
|
|
~ParticleRenderer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an emitter for rendering in this frame.
|
|
|
|
*/
|
2014-06-25 03:11:10 +02:00
|
|
|
void Submit(int cullGroup, CParticleEmitter* emitter);
|
2011-04-03 21:15:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare internal data structures for rendering.
|
|
|
|
* Must be called after all Submit calls for a frame, and before
|
|
|
|
* any rendering calls.
|
|
|
|
*/
|
2012-04-03 20:44:46 +02:00
|
|
|
void PrepareForRendering(const CShaderDefines& context);
|
2011-04-03 21:15:15 +02:00
|
|
|
|
2022-11-06 12:31:05 +01:00
|
|
|
/**
|
|
|
|
* Upload internal data to the backend. Must be called after the data is
|
|
|
|
* prepared and before any rendering calls.
|
|
|
|
*/
|
|
|
|
void Upload(
|
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
|
|
|
|
2011-04-03 21:15:15 +02:00
|
|
|
/**
|
|
|
|
* Reset the list of submitted overlays.
|
|
|
|
*/
|
|
|
|
void EndFrame();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render all the submitted particles.
|
|
|
|
*/
|
2022-01-19 18:28:47 +01:00
|
|
|
void RenderParticles(
|
2022-05-09 00:02:46 +02:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2022-02-25 23:05:06 +01:00
|
|
|
int cullGroup, bool wireframe = false);
|
2011-04-03 21:15:15 +02:00
|
|
|
|
2011-04-29 14:26:31 +02:00
|
|
|
/**
|
|
|
|
* Render bounding boxes for all the submitted emitters.
|
|
|
|
*/
|
2021-04-27 21:23:37 +02:00
|
|
|
void RenderBounds(int cullGroup);
|
2011-04-29 14:26:31 +02:00
|
|
|
|
2011-04-03 21:15:15 +02:00
|
|
|
private:
|
|
|
|
ParticleRendererInternals* m;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDED_PARTICLERENDERER
|