mirror of https://github.com/axmolengine/axmol.git
Merge pull request #19508 from Mee-gu/feature/UpdateParticle3D
[BugFix] fix particle3D
This commit is contained in:
commit
63fde51dc8
|
@ -715,7 +715,12 @@ LayerRadialGradient::LayerRadialGradient()
|
|||
_expandLocation = pipelineDescriptor.programState->getUniformLocation("u_expand");
|
||||
|
||||
auto& vertexLayout = _customCommand.getPipelineDescriptor().vertexLayout;
|
||||
vertexLayout.setAtrribute("a_position", 0, backend::VertexFormat::FLOAT2, 0, false);
|
||||
const auto& attributeInfo = _programState->getProgram()->getActiveAttributes();
|
||||
auto iter = attributeInfo.find("a_position");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
vertexLayout.setAtrribute("a_position", iter->second.location, backend::VertexFormat::FLOAT2, 0, false);
|
||||
}
|
||||
vertexLayout.setLayout(sizeof(_vertices[0]), backend::VertexStepMode::VERTEX);
|
||||
|
||||
_customCommand.createVertexBuffer(sizeof(_vertices[0]), sizeof(_vertices) / sizeof(_vertices[0]), CustomCommand::BufferUsage::STATIC);
|
||||
|
|
|
@ -206,10 +206,22 @@ bool Particle3DQuadRender::initQuadRender( const std::string& texFile )
|
|||
auto &pipelineDescriptor = _meshCommand.getPipelineDescriptor();
|
||||
pipelineDescriptor.programState = _programState;
|
||||
auto &layout = pipelineDescriptor.vertexLayout;
|
||||
|
||||
layout.setAtrribute("a_position", 0, backend::VertexFormat::FLOAT3, offsetof(posuvcolor, position), false);
|
||||
layout.setAtrribute("a_texCoord", 1, backend::VertexFormat::FLOAT2, offsetof(posuvcolor, uv), false);
|
||||
layout.setAtrribute("a_color", 2, backend::VertexFormat::FLOAT4, offsetof(posuvcolor, color), false);
|
||||
const auto& attributeInfo = _programState->getProgram()->getActiveAttributes();
|
||||
auto iter = attributeInfo.find("a_position");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_position", iter->second.location, backend::VertexFormat::FLOAT3, offsetof(posuvcolor, position), false);
|
||||
}
|
||||
iter = attributeInfo.find("a_texCoord");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_texCoord", iter->second.location, backend::VertexFormat::FLOAT2, offsetof(posuvcolor, uv), false);
|
||||
}
|
||||
iter = attributeInfo.find("a_color");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_color", iter->second.location, backend::VertexFormat::FLOAT4, offsetof(posuvcolor, color), false);
|
||||
}
|
||||
layout.setLayout(sizeof(posuvcolor), backend::VertexStepMode::VERTEX);
|
||||
|
||||
_locColor = _programState->getUniformLocation("u_color");
|
||||
|
|
|
@ -664,15 +664,25 @@ void PUBillboardChain::init( const std::string &texFile )
|
|||
_programState = new backend::ProgramState(CC3D_particle_vert, CC3D_particleColor_frag);
|
||||
}
|
||||
|
||||
GLsizei stride = sizeof(VertexInfo);
|
||||
|
||||
auto &pipelineDescriptor = _meshCommand.getPipelineDescriptor();
|
||||
pipelineDescriptor.programState = _programState;
|
||||
auto &layout = pipelineDescriptor.vertexLayout;
|
||||
|
||||
layout.setAtrribute("a_position", 0, backend::VertexFormat::FLOAT3, offsetof(VertexInfo, position), false);
|
||||
layout.setAtrribute("a_texCoord", 1, backend::VertexFormat::FLOAT2, offsetof(VertexInfo, uv), false);
|
||||
layout.setAtrribute("a_color", 2, backend::VertexFormat::FLOAT4, offsetof(VertexInfo, color), false);
|
||||
const auto& attributeInfo = _programState->getProgram()->getActiveAttributes();
|
||||
auto iter = attributeInfo.find("a_position");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_position", iter->second.location, backend::VertexFormat::FLOAT3, offsetof(VertexInfo, position), false);
|
||||
}
|
||||
iter = attributeInfo.find("a_texCoord");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_texCoord", iter->second.location, backend::VertexFormat::FLOAT2, offsetof(VertexInfo, uv), false);
|
||||
}
|
||||
iter = attributeInfo.find("a_color");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_color", iter->second.location, backend::VertexFormat::FLOAT4, offsetof(VertexInfo, color), false);
|
||||
}
|
||||
layout.setLayout(sizeof(VertexInfo), backend::VertexStepMode::VERTEX);
|
||||
|
||||
_locColor = _programState->getUniformLocation("u_color");
|
||||
|
|
|
@ -604,10 +604,22 @@ bool PUParticle3DEntityRender::initRender( const std::string &texFile )
|
|||
auto &pipelineDescriptor = _meshCommand.getPipelineDescriptor();
|
||||
pipelineDescriptor.programState = _programState;
|
||||
auto &layout = pipelineDescriptor.vertexLayout;
|
||||
|
||||
layout.setAtrribute("a_position", 0, backend::VertexFormat::FLOAT3, offsetof(VertexInfo, position), false);
|
||||
layout.setAtrribute("a_texCoord", 1, backend::VertexFormat::FLOAT2, offsetof(VertexInfo, uv), false);
|
||||
layout.setAtrribute("a_color", 2, backend::VertexFormat::FLOAT4, offsetof(VertexInfo, color), false);
|
||||
const auto& attributeInfo = _programState->getProgram()->getActiveAttributes();
|
||||
auto iter = attributeInfo.find("a_position");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_position", iter->second.location, backend::VertexFormat::FLOAT3, offsetof(VertexInfo, position), false);
|
||||
}
|
||||
iter = attributeInfo.find("a_texCoord");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_texCoord", iter->second.location, backend::VertexFormat::FLOAT2, offsetof(VertexInfo, uv), false);
|
||||
}
|
||||
iter = attributeInfo.find("a_color");
|
||||
if(iter != attributeInfo.end())
|
||||
{
|
||||
layout.setAtrribute("a_color", iter->second.location, backend::VertexFormat::FLOAT4, offsetof(VertexInfo, color), false);
|
||||
}
|
||||
layout.setLayout(sizeof(VertexInfo), backend::VertexStepMode::VERTEX);
|
||||
|
||||
_locColor = _programState->getUniformLocation("u_color");
|
||||
|
|
Loading…
Reference in New Issue