Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ParticleEmitter.cpp
/* Copyright (C) 2015 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | CParticleEmitter::CParticleEmitter(const CParticleEmitterTypePtr& type) : | ||||
m_VertexArray.AddAttribute(&m_AttributeColor); | m_VertexArray.AddAttribute(&m_AttributeColor); | ||||
m_VertexArray.SetNumVertices(m_Type->m_MaxParticles * 4); | m_VertexArray.SetNumVertices(m_Type->m_MaxParticles * 4); | ||||
m_VertexArray.Layout(); | m_VertexArray.Layout(); | ||||
m_IndexArray.SetNumVertices(m_Type->m_MaxParticles * 6); | m_IndexArray.SetNumVertices(m_Type->m_MaxParticles * 6); | ||||
m_IndexArray.Layout(); | m_IndexArray.Layout(); | ||||
VertexArrayIterator<u16> index = m_IndexArray.GetIterator(); | VertexArrayIterator<u16> index = m_IndexArray.GetIterator(); | ||||
for (size_t i = 0; i < m_Type->m_MaxParticles; ++i) | for (u16 i = 0; i < m_Type->m_MaxParticles; ++i) | ||||
{ | { | ||||
*index++ = i*4 + 0; | *index++ = i*4 + 0; | ||||
*index++ = i*4 + 1; | *index++ = i*4 + 1; | ||||
*index++ = i*4 + 2; | *index++ = i*4 + 2; | ||||
*index++ = i*4 + 2; | *index++ = i*4 + 2; | ||||
*index++ = i*4 + 3; | *index++ = i*4 + 3; | ||||
*index++ = i*4 + 0; | *index++ = i*4 + 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator