Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ParticleEmitter.cpp
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | void CParticleEmitter::UpdateArrayData(int frameNumber) | ||||
m_VertexArray.Upload(); | m_VertexArray.Upload(); | ||||
} | } | ||||
void CParticleEmitter::PrepareForRendering() | void CParticleEmitter::PrepareForRendering() | ||||
{ | { | ||||
m_VertexArray.PrepareForRendering(); | m_VertexArray.PrepareForRendering(); | ||||
} | } | ||||
void CParticleEmitter::UploadData( | |||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext) | |||||
{ | |||||
m_VertexArray.UploadIfNeeded(deviceCommandContext); | |||||
} | |||||
void CParticleEmitter::Bind( | void CParticleEmitter::Bind( | ||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext, | Renderer::Backend::IDeviceCommandContext* deviceCommandContext, | ||||
Renderer::Backend::IShaderProgram* shader) | Renderer::Backend::IShaderProgram* shader) | ||||
{ | { | ||||
m_Type->m_Texture->UploadBackendTextureIfNeeded(deviceCommandContext); | m_Type->m_Texture->UploadBackendTextureIfNeeded(deviceCommandContext); | ||||
CLOSTexture& los = g_Renderer.GetSceneRenderer().GetScene().GetLOSTexture(); | CLOSTexture& los = g_Renderer.GetSceneRenderer().GetScene().GetLOSTexture(); | ||||
deviceCommandContext->SetTexture( | deviceCommandContext->SetTexture( | ||||
Show All 16 Lines | |||||
} | } | ||||
void CParticleEmitter::RenderArray( | void CParticleEmitter::RenderArray( | ||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext) | Renderer::Backend::IDeviceCommandContext* deviceCommandContext) | ||||
{ | { | ||||
if (m_Particles.empty()) | if (m_Particles.empty()) | ||||
return; | return; | ||||
m_VertexArray.UploadIfNeeded(deviceCommandContext); | |||||
m_IndexArray.UploadIfNeeded(deviceCommandContext); | |||||
const uint32_t stride = m_VertexArray.GetStride(); | const uint32_t stride = m_VertexArray.GetStride(); | ||||
const uint32_t firstVertexOffset = m_VertexArray.GetOffset() * stride; | const uint32_t firstVertexOffset = m_VertexArray.GetOffset() * stride; | ||||
deviceCommandContext->SetVertexAttributeFormat( | deviceCommandContext->SetVertexAttributeFormat( | ||||
Renderer::Backend::VertexAttributeStream::POSITION, | Renderer::Backend::VertexAttributeStream::POSITION, | ||||
m_AttributePos.format, m_AttributePos.offset, stride, | m_AttributePos.format, m_AttributePos.offset, stride, | ||||
Renderer::Backend::VertexAttributeRate::PER_VERTEX, 0); | Renderer::Backend::VertexAttributeRate::PER_VERTEX, 0); | ||||
deviceCommandContext->SetVertexAttributeFormat( | deviceCommandContext->SetVertexAttributeFormat( | ||||
Show All 35 Lines | void CParticleEmitter::AddParticle(const SParticle& particle) | ||||
m_NextParticleIdx = (m_NextParticleIdx + 1) % m_Type->m_MaxParticles; | m_NextParticleIdx = (m_NextParticleIdx + 1) % m_Type->m_MaxParticles; | ||||
} | } | ||||
void CParticleEmitter::SetEntityVariable(const std::string& name, float value) | void CParticleEmitter::SetEntityVariable(const std::string& name, float value) | ||||
{ | { | ||||
m_EntityVariables[name] = value; | m_EntityVariables[name] = value; | ||||
} | } | ||||
CModelParticleEmitter::CModelParticleEmitter(const CParticleEmitterTypePtr& type) : | CModelParticleEmitter::CModelParticleEmitter(const CParticleEmitterTypePtr& type) : | ||||
m_Type(type) | m_Type(type) | ||||
{ | { | ||||
m_Emitter = CParticleEmitterPtr(new CParticleEmitter(m_Type)); | m_Emitter = CParticleEmitterPtr(new CParticleEmitter(m_Type)); | ||||
} | } | ||||
CModelParticleEmitter::~CModelParticleEmitter() | CModelParticleEmitter::~CModelParticleEmitter() | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator