Add Particle Radius to in-built particle attributes

This commit is contained in:
Wojtek Figat
2021-03-05 14:33:31 +01:00
parent dbc88af339
commit dd1dd2ef8a
8 changed files with 44 additions and 0 deletions

View File

@@ -615,6 +615,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
case 260:
case 261:
case 262:
case 263:
case 350:
case 351:
case 352:
@@ -628,6 +629,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
case 360:
case 361:
case 362:
case 363:
{
auto& attribute = _data->Buffer->Layout->Attributes[node->Attributes[0]];
byte* dataPtr = start + attribute.Offset;

View File

@@ -286,6 +286,12 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParticles(Box* box, Node* node
const float lifetime = GET_PARTICLE_ATTRIBUTE(1, float);
value = age / Math::Max(lifetime, ZeroTolerance);
break;
}
// Particle Radius
case 111:
{
value = GET_PARTICLE_ATTRIBUTE(0, float);
break;
}
// Effect Position
case 200:

View File

@@ -248,6 +248,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
case 260:
case 261:
case 262:
case 263:
case 350:
case 351:
case 352:
@@ -261,6 +262,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
case 360:
case 361:
case 362:
case 363:
{
auto attribute = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
auto box = node->GetBox(0);

View File

@@ -346,6 +346,12 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
const auto lifetime = AccessParticleAttribute(node, TEXT("Lifetime"), ParticleAttribute::ValueTypes::Float, AccessMode::Read);
value = writeOperation2(node, age, lifetime, '/');
break;
}
// Particle Radius
case 111:
{
value = AccessParticleAttribute(node, TEXT("Radius"), ParticleAttribute::ValueTypes::Float, AccessMode::Read);
break;
}
// Effect Position
case 200:

View File

@@ -291,6 +291,13 @@ protected:
USE_ATTRIBUTE(Age, Float, 0);
USE_ATTRIBUTE(Lifetime, Float, 1);
break;
}
// Particle Mass
case GRAPH_NODE_MAKE_TYPE(14, 111):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Radius, Float, 0);
break;
}
// Random
case GRAPH_NODE_MAKE_TYPE(14, 208):
@@ -425,6 +432,7 @@ protected:
CASE_SET_PARTICLE_ATTRIBUTE(260, 360, RibbonWidth, Float);
CASE_SET_PARTICLE_ATTRIBUTE(261, 361, RibbonTwist, Float);
CASE_SET_PARTICLE_ATTRIBUTE(262, 362, RibbonFacingVector, Vector3);
CASE_SET_PARTICLE_ATTRIBUTE(263, 363, Radius, Float);
#undef CASE_SET_PARTICLE_ATTRIBUTE
// Conform to Sphere
case GRAPH_NODE_MAKE_TYPE(15, 305):