Format code for shader generators
This commit is contained in:
@@ -121,14 +121,14 @@ int32 ParticleEmitterGraphCPUExecutor::ProcessSpawnModule(int32 index)
|
||||
// Calculate particles to spawn during this frame
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Constant Spawn Rate
|
||||
// Constant Spawn Rate
|
||||
case 100:
|
||||
{
|
||||
const float rate = Math::Max((float)TryGetValue(node->GetBox(0), node->Values[2]), 0.0f);
|
||||
spawnCount += rate * context.DeltaTime;
|
||||
break;
|
||||
}
|
||||
// Single Burst
|
||||
// Single Burst
|
||||
case 101:
|
||||
{
|
||||
const bool isFirstUpdate = (context.Data->Time - context.DeltaTime) <= 0.0f;
|
||||
@@ -139,7 +139,7 @@ int32 ParticleEmitterGraphCPUExecutor::ProcessSpawnModule(int32 index)
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Periodic
|
||||
// Periodic
|
||||
case 102:
|
||||
{
|
||||
float& nextSpawnTime = data.NextSpawnTime;
|
||||
@@ -152,7 +152,7 @@ int32 ParticleEmitterGraphCPUExecutor::ProcessSpawnModule(int32 index)
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Periodic Burst (range)
|
||||
// Periodic Burst (range)
|
||||
case 103:
|
||||
{
|
||||
float& nextSpawnTime = data.NextSpawnTime;
|
||||
@@ -186,7 +186,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Orient Sprite
|
||||
// Orient Sprite
|
||||
case 201:
|
||||
case 303:
|
||||
{
|
||||
@@ -229,7 +229,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Orient Model
|
||||
// Orient Model
|
||||
case 213:
|
||||
case 309:
|
||||
{
|
||||
@@ -246,7 +246,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Update Age
|
||||
// Update Age
|
||||
case 300:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Update Age");
|
||||
@@ -259,7 +259,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Gravity/Force
|
||||
// Gravity/Force
|
||||
case 301:
|
||||
case 304:
|
||||
{
|
||||
@@ -288,7 +288,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Conform to Sphere
|
||||
// Conform to Sphere
|
||||
case 305:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Conform to Sphere");
|
||||
@@ -351,7 +351,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Kill (sphere)
|
||||
// Kill (sphere)
|
||||
case 306:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Kill");
|
||||
@@ -400,7 +400,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Kill (box)
|
||||
// Kill (box)
|
||||
case 307:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Kill");
|
||||
@@ -454,7 +454,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Kill (custom)
|
||||
// Kill (custom)
|
||||
case 308:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Kill (custom)");
|
||||
@@ -492,7 +492,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Linear Drag
|
||||
// Linear Drag
|
||||
case 310:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Linear Drag");
|
||||
@@ -538,7 +538,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Turbulence
|
||||
// Turbulence
|
||||
case 311:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Turbulence");
|
||||
@@ -598,7 +598,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Set Attribute
|
||||
// Set Attribute
|
||||
case 200:
|
||||
case 302:
|
||||
{
|
||||
@@ -630,7 +630,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Set Position/Lifetime/Age/..
|
||||
// Set Position/Lifetime/Age/..
|
||||
case 250:
|
||||
case 251:
|
||||
case 252:
|
||||
@@ -688,7 +688,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Position (sphere surface)
|
||||
// Position (sphere surface)
|
||||
case 202:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -734,7 +734,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (plane)
|
||||
// Position (plane)
|
||||
case 203:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -773,7 +773,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (circle)
|
||||
// Position (circle)
|
||||
case 204:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -817,7 +817,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (disc)
|
||||
// Position (disc)
|
||||
case 205:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -861,7 +861,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (box surface)
|
||||
// Position (box surface)
|
||||
case 206:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -912,7 +912,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (box volume)
|
||||
// Position (box volume)
|
||||
case 207:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -951,7 +951,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (cylinder)
|
||||
// Position (cylinder)
|
||||
case 208:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -997,7 +997,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (line)
|
||||
// Position (line)
|
||||
case 209:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -1036,7 +1036,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (torus)
|
||||
// Position (torus)
|
||||
case 210:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -1101,7 +1101,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (sphere volume)
|
||||
// Position (sphere volume)
|
||||
case 211:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -1147,13 +1147,13 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (depth)
|
||||
// Position (depth)
|
||||
case 212:
|
||||
{
|
||||
// Not supported
|
||||
break;
|
||||
}
|
||||
// Position (spiral)
|
||||
// Position (spiral)
|
||||
case 214:
|
||||
{
|
||||
PARTICLE_EMITTER_MODULE("Position");
|
||||
@@ -1204,14 +1204,14 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Position (Global SDF)
|
||||
// Position (Global SDF)
|
||||
case 215:
|
||||
{
|
||||
// Not supported
|
||||
break;
|
||||
}
|
||||
|
||||
// Helper macros for collision modules to share the code
|
||||
// Helper macros for collision modules to share the code
|
||||
#define COLLISION_BEGIN() \
|
||||
PARTICLE_EMITTER_MODULE("Collision"); \
|
||||
auto& positionAttr = context.Data->Buffer->Layout->Attributes[node->Attributes[0]]; \
|
||||
@@ -1251,7 +1251,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
velocityPtr += stride; \
|
||||
agePtr += stride
|
||||
|
||||
// Collision (plane)
|
||||
// Collision (plane)
|
||||
case 330:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -1293,7 +1293,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Collision (sphere)
|
||||
// Collision (sphere)
|
||||
case 331:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -1338,7 +1338,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Collision (box)
|
||||
// Collision (box)
|
||||
case 332:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -1398,7 +1398,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Collision (cylinder)
|
||||
// Collision (cylinder)
|
||||
case 333:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -1463,19 +1463,19 @@ void ParticleEmitterGraphCPUExecutor::ProcessModule(ParticleEmitterGraphCPUNode*
|
||||
#undef LOGIC
|
||||
break;
|
||||
}
|
||||
// Collision (depth)
|
||||
// Collision (depth)
|
||||
case 334:
|
||||
{
|
||||
// Not supported
|
||||
break;
|
||||
}
|
||||
// Conform to Global SDF
|
||||
// Conform to Global SDF
|
||||
case 335:
|
||||
{
|
||||
// Not supported
|
||||
break;
|
||||
}
|
||||
// Collision (Global SDF)
|
||||
// Collision (Global SDF)
|
||||
case 336:
|
||||
{
|
||||
// Not supported
|
||||
|
||||
@@ -15,7 +15,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParameters(Box* box, Node* nod
|
||||
auto& context = Context.Get();
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Get
|
||||
// Get
|
||||
case 2:
|
||||
{
|
||||
int32 paramIndex;
|
||||
@@ -96,28 +96,28 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupTextures(Box* box, Node* node,
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Scene Texture
|
||||
// Scene Texture
|
||||
case 6:
|
||||
{
|
||||
// Not supported
|
||||
value = Value::Zero;
|
||||
break;
|
||||
}
|
||||
// Scene Depth
|
||||
// Scene Depth
|
||||
case 8:
|
||||
{
|
||||
// Not supported
|
||||
value = Value::Zero;
|
||||
break;
|
||||
}
|
||||
// Texture
|
||||
// Texture
|
||||
case 11:
|
||||
{
|
||||
// TODO: support sampling textures in CPU particles
|
||||
value = Value::Zero;
|
||||
break;
|
||||
}
|
||||
// Load Texture
|
||||
// Load Texture
|
||||
case 13:
|
||||
{
|
||||
// TODO: support sampling textures in CPU particles
|
||||
@@ -141,18 +141,18 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupTools(Box* box, Node* node, Va
|
||||
auto& context = Context.Get();
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Linearize Depth
|
||||
// Linearize Depth
|
||||
case 7:
|
||||
{
|
||||
// TODO: support Linearize Depth in CPU particles
|
||||
value = Value::Zero;
|
||||
break;
|
||||
}
|
||||
// Time
|
||||
// Time
|
||||
case 8:
|
||||
value = box->ID == 0 ? context.Data->Time : context.DeltaTime;
|
||||
break;
|
||||
// Transform Position To Screen UV
|
||||
// Transform Position To Screen UV
|
||||
case 9:
|
||||
{
|
||||
GET_VIEW();
|
||||
@@ -176,7 +176,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParticles(Box* box, Node* node
|
||||
auto node = (ParticleEmitterGraphCPUNode*)nodeBase;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Particle Attribute
|
||||
// Particle Attribute
|
||||
case 100:
|
||||
{
|
||||
byte* ptr = ACCESS_PARTICLE_ATTRIBUTE(0);
|
||||
@@ -204,7 +204,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParticles(Box* box, Node* node
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Particle Attribute (by index)
|
||||
// Particle Attribute (by index)
|
||||
case 303:
|
||||
{
|
||||
const auto particleIndex = tryGetValue(node->GetBox(1), context.ParticleIndex);
|
||||
@@ -233,61 +233,61 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParticles(Box* box, Node* node
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Particle Position
|
||||
// Particle Position
|
||||
case 101:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, Vector3);
|
||||
break;
|
||||
}
|
||||
// Particle Lifetime
|
||||
// Particle Lifetime
|
||||
case 102:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, float);
|
||||
break;
|
||||
}
|
||||
// Particle Age
|
||||
// Particle Age
|
||||
case 103:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, float);
|
||||
break;
|
||||
}
|
||||
// Particle Color
|
||||
// Particle Color
|
||||
case 104:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, Vector4);
|
||||
break;
|
||||
}
|
||||
// Particle Velocity
|
||||
// Particle Velocity
|
||||
case 105:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, Vector3);
|
||||
break;
|
||||
}
|
||||
// Particle Sprite Size
|
||||
// Particle Sprite Size
|
||||
case 106:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, Vector2);
|
||||
break;
|
||||
}
|
||||
// Particle Mass
|
||||
// Particle Mass
|
||||
case 107:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, float);
|
||||
break;
|
||||
}
|
||||
// Particle Rotation
|
||||
// Particle Rotation
|
||||
case 108:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, Vector3);
|
||||
break;
|
||||
}
|
||||
// Particle Angular Velocity
|
||||
// Particle Angular Velocity
|
||||
case 109:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, Vector3);
|
||||
break;
|
||||
}
|
||||
// Particle Normalized Age
|
||||
// Particle Normalized Age
|
||||
case 110:
|
||||
{
|
||||
const float age = GET_PARTICLE_ATTRIBUTE(0, float);
|
||||
@@ -295,55 +295,55 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParticles(Box* box, Node* node
|
||||
value = age / Math::Max(lifetime, ZeroTolerance);
|
||||
break;
|
||||
}
|
||||
// Particle Radius
|
||||
// Particle Radius
|
||||
case 111:
|
||||
{
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, float);
|
||||
break;
|
||||
}
|
||||
// Effect Position
|
||||
// Effect Position
|
||||
case 200:
|
||||
{
|
||||
value = context.Effect->GetPosition();
|
||||
break;
|
||||
}
|
||||
// Effect Rotation
|
||||
// Effect Rotation
|
||||
case 201:
|
||||
{
|
||||
value = context.Effect->GetOrientation();
|
||||
break;
|
||||
}
|
||||
// Effect Scale
|
||||
// Effect Scale
|
||||
case 202:
|
||||
{
|
||||
value = context.Effect->GetScale();
|
||||
break;
|
||||
}
|
||||
// Simulation Mode
|
||||
// Simulation Mode
|
||||
case 203:
|
||||
{
|
||||
value = box->ID == 0;
|
||||
break;
|
||||
}
|
||||
// View Position
|
||||
// View Position
|
||||
case 204:
|
||||
{
|
||||
value = context.ViewTask ? context.ViewTask->View.Position : Vector3::Zero;
|
||||
break;
|
||||
}
|
||||
// View Direction
|
||||
// View Direction
|
||||
case 205:
|
||||
{
|
||||
value = context.ViewTask ? context.ViewTask->View.Direction : Vector3::Forward;
|
||||
break;
|
||||
}
|
||||
// View Far Plane
|
||||
// View Far Plane
|
||||
case 206:
|
||||
{
|
||||
value = context.ViewTask ? context.ViewTask->View.Far : 0.0f;
|
||||
break;
|
||||
}
|
||||
// Screen Size
|
||||
// Screen Size
|
||||
case 207:
|
||||
{
|
||||
const Vector4 size = context.ViewTask ? context.ViewTask->View.ScreenSize : Vector4::Zero;
|
||||
@@ -353,13 +353,13 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParticles(Box* box, Node* node
|
||||
value = Vector2(size.Z, size.W);
|
||||
break;
|
||||
}
|
||||
// Particle Position (world space)
|
||||
// Particle Position (world space)
|
||||
case 212:
|
||||
value = GET_PARTICLE_ATTRIBUTE(0, Vector3);
|
||||
if (context.Emitter->SimulationSpace == ParticlesSimulationSpace::Local)
|
||||
value.AsVector3() = context.Effect->GetTransform().LocalToWorld(value.AsVector3());
|
||||
break;
|
||||
// Particle Emitter Function
|
||||
// Particle Emitter Function
|
||||
case 300:
|
||||
{
|
||||
// Load function asset
|
||||
@@ -406,11 +406,11 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupParticles(Box* box, Node* node
|
||||
context.GraphStack.Pop();
|
||||
break;
|
||||
}
|
||||
// Particle Index
|
||||
// Particle Index
|
||||
case 301:
|
||||
value = context.ParticleIndex;
|
||||
break;
|
||||
// Particles Count
|
||||
// Particles Count
|
||||
case 302:
|
||||
value = (uint32)context.Data->Buffer->CPU.Count;
|
||||
break;
|
||||
@@ -425,7 +425,7 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupFunction(Box* box, Node* node,
|
||||
auto& context = Context.Get();
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Function Input
|
||||
// Function Input
|
||||
case 1:
|
||||
{
|
||||
// Find the function call
|
||||
|
||||
@@ -102,7 +102,7 @@ void ParticleEmitterGraphCPU::InitializeNode(Node* node)
|
||||
|
||||
switch (node->Type)
|
||||
{
|
||||
// Position (spiral)
|
||||
// Position (spiral)
|
||||
case GRAPH_NODE_MAKE_TYPE(15, 214):
|
||||
node->CustomDataOffset = CustomDataSize;
|
||||
CustomDataSize += sizeof(float);
|
||||
@@ -226,7 +226,7 @@ bool ParticleEmitterGraphCPUExecutor::ComputeBounds(ParticleEmitter* emitter, Pa
|
||||
const auto module = emitter->Graph.RenderModules[moduleIndex];
|
||||
switch (module->TypeID)
|
||||
{
|
||||
// Sprite Rendering
|
||||
// Sprite Rendering
|
||||
case 400:
|
||||
{
|
||||
if (_graph._attrSpriteSize != -1)
|
||||
@@ -246,7 +246,7 @@ bool ParticleEmitterGraphCPUExecutor::ComputeBounds(ParticleEmitter* emitter, Pa
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Light Rendering
|
||||
// Light Rendering
|
||||
case 401:
|
||||
{
|
||||
// Prepare graph data
|
||||
@@ -269,7 +269,7 @@ bool ParticleEmitterGraphCPUExecutor::ComputeBounds(ParticleEmitter* emitter, Pa
|
||||
|
||||
break;
|
||||
}
|
||||
// Model Rendering
|
||||
// Model Rendering
|
||||
case 403:
|
||||
{
|
||||
const auto modelAsset = (Model*)module->Assets[0].Get();
|
||||
@@ -297,7 +297,7 @@ bool ParticleEmitterGraphCPUExecutor::ComputeBounds(ParticleEmitter* emitter, Pa
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Ribbon Rendering
|
||||
// Ribbon Rendering
|
||||
case 404:
|
||||
{
|
||||
if (_graph._attrRibbonWidth != -1)
|
||||
@@ -317,7 +317,7 @@ bool ParticleEmitterGraphCPUExecutor::ComputeBounds(ParticleEmitter* emitter, Pa
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Volumetric Fog Rendering
|
||||
// Volumetric Fog Rendering
|
||||
case 405:
|
||||
{
|
||||
// Find the maximum radius of the particle
|
||||
|
||||
@@ -10,7 +10,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
auto nodeGpu = (ParticleEmitterGraphGPUNode*)node;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Orient Sprite
|
||||
// Orient Sprite
|
||||
case 201:
|
||||
case 303:
|
||||
{
|
||||
@@ -28,7 +28,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Orient Model
|
||||
// Orient Model
|
||||
case 213:
|
||||
case 309:
|
||||
{
|
||||
@@ -39,14 +39,14 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Update Age
|
||||
// Update Age
|
||||
case 300:
|
||||
{
|
||||
auto attribute = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::ReadWrite);
|
||||
_writer.Write(TEXT("\t{0} += DeltaTime;\n"), attribute.Value);
|
||||
break;
|
||||
}
|
||||
// Gravity/Force
|
||||
// Gravity/Force
|
||||
case 301:
|
||||
case 304:
|
||||
{
|
||||
@@ -55,7 +55,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
_writer.Write(TEXT("\t{0} += {1} * DeltaTime;\n"), attribute.Value, force.Value);
|
||||
break;
|
||||
}
|
||||
// Conform to Sphere
|
||||
// Conform to Sphere
|
||||
case 305:
|
||||
{
|
||||
auto position = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Read);
|
||||
@@ -94,7 +94,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), position.Value, velocity.Value, mass.Value, sphereCenter.Value, sphereRadius.Value, attractionSpeed.Value, attractionForce.Value, stickDistance.Value, stickForce.Value);
|
||||
break;
|
||||
}
|
||||
// Kill (sphere)
|
||||
// Kill (sphere)
|
||||
case 306:
|
||||
{
|
||||
UseKill();
|
||||
@@ -119,7 +119,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), position.Value, sphereCenter.Value, sphereRadius.Value, sign);
|
||||
break;
|
||||
}
|
||||
// Kill (box)
|
||||
// Kill (box)
|
||||
case 307:
|
||||
{
|
||||
UseKill();
|
||||
@@ -149,7 +149,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), position.Value, boxCenter.Value, boxSize.Value, invert);
|
||||
break;
|
||||
}
|
||||
// Kill (custom)
|
||||
// Kill (custom)
|
||||
case 308:
|
||||
{
|
||||
UseKill();
|
||||
@@ -162,7 +162,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), kill.Value);
|
||||
break;
|
||||
}
|
||||
// Linear Drag
|
||||
// Linear Drag
|
||||
case 310:
|
||||
{
|
||||
const bool useSpriteSize = node->Values[3].AsBool;
|
||||
@@ -195,7 +195,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Turbulence
|
||||
// Turbulence
|
||||
case 311:
|
||||
{
|
||||
auto position = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Read);
|
||||
@@ -225,7 +225,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), position.Value, velocity.Value, mass.Value, fieldPosition.Value, fieldRotation.Value, fieldScale.Value, roughness.Value, intensity.Value, octavesCount.Value);
|
||||
break;
|
||||
}
|
||||
// Set Attribute
|
||||
// Set Attribute
|
||||
case 200:
|
||||
case 302:
|
||||
{
|
||||
@@ -235,7 +235,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
SET_ATTRIBUTE(attribute, value.Value);
|
||||
break;
|
||||
}
|
||||
// Set Position/Lifetime/Age/..
|
||||
// Set Position/Lifetime/Age/..
|
||||
case 250:
|
||||
case 251:
|
||||
case 252:
|
||||
@@ -271,7 +271,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
SET_ATTRIBUTE(attribute, value.Value);
|
||||
break;
|
||||
}
|
||||
// Position (sphere surface)
|
||||
// Position (sphere surface)
|
||||
case 202:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -298,7 +298,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, 0, center.Value, radius.Value, arc.Value);
|
||||
break;
|
||||
}
|
||||
// Position (plane)
|
||||
// Position (plane)
|
||||
case 203:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -318,7 +318,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, center.Value, size.Value);
|
||||
break;
|
||||
}
|
||||
// Position (circle)
|
||||
// Position (circle)
|
||||
case 204:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -343,7 +343,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, 0, center.Value, radius.Value, arc.Value);
|
||||
break;
|
||||
}
|
||||
// Position (disc)
|
||||
// Position (disc)
|
||||
case 205:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -368,7 +368,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, 0, center.Value, radius.Value, arc.Value);
|
||||
break;
|
||||
}
|
||||
// Position (box surface)
|
||||
// Position (box surface)
|
||||
case 206:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -400,7 +400,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, center.Value, size.Value);
|
||||
break;
|
||||
}
|
||||
// Position (box volume)
|
||||
// Position (box volume)
|
||||
case 207:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -420,7 +420,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, center.Value, size.Value);
|
||||
break;
|
||||
}
|
||||
// Position (cylinder)
|
||||
// Position (cylinder)
|
||||
case 208:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -447,7 +447,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, center.Value, radius.Value, height.Value, arc.Value);
|
||||
break;
|
||||
}
|
||||
// Position (line)
|
||||
// Position (line)
|
||||
case 209:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -467,7 +467,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, start.Value, end.Value);
|
||||
break;
|
||||
}
|
||||
// Position (torus)
|
||||
// Position (torus)
|
||||
case 210:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -513,7 +513,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, 0, center.Value, radius.Value, thickness.Value, arc.Value);
|
||||
break;
|
||||
}
|
||||
// Position (sphere volume)
|
||||
// Position (sphere volume)
|
||||
case 211:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -540,7 +540,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, 0, center.Value, radius.Value, arc.Value);
|
||||
break;
|
||||
}
|
||||
// Position (depth)
|
||||
// Position (depth)
|
||||
case 212:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -574,7 +574,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), positionAttr.Value, uv.Value, depthCullRange.Value, depthOffset.Value, linearDepth.Value, lifetimeAttr.Value);
|
||||
break;
|
||||
}
|
||||
// Position (spiral)
|
||||
// Position (spiral)
|
||||
case 214:
|
||||
{
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Write);
|
||||
@@ -632,7 +632,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
break;
|
||||
}
|
||||
|
||||
// Helper macros for collision modules to share the code
|
||||
// Helper macros for collision modules to share the code
|
||||
#define COLLISION_BEGIN() \
|
||||
auto positionAttr = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::ReadWrite); \
|
||||
auto velocityAttr = AccessParticleAttribute(node, nodeGpu->Attributes[1], AccessMode::ReadWrite); \
|
||||
@@ -662,7 +662,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
" {2} += {9};\n" \
|
||||
" }}\n"
|
||||
|
||||
// Collision (plane)
|
||||
// Collision (plane)
|
||||
case 330:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -690,7 +690,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
);
|
||||
break;
|
||||
}
|
||||
// Collision (sphere)
|
||||
// Collision (sphere)
|
||||
case 331:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -721,7 +721,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
);
|
||||
break;
|
||||
}
|
||||
// Collision (box)
|
||||
// Collision (box)
|
||||
case 332:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -767,7 +767,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
);
|
||||
break;
|
||||
}
|
||||
// Collision (cylinder)
|
||||
// Collision (cylinder)
|
||||
case 333:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -817,7 +817,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
);
|
||||
break;
|
||||
}
|
||||
// Collision (depth)
|
||||
// Collision (depth)
|
||||
case 334:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
@@ -872,18 +872,18 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
);
|
||||
break;
|
||||
}
|
||||
// Conform to Global SDF
|
||||
// Conform to Global SDF
|
||||
case 335:
|
||||
{
|
||||
auto position = AccessParticleAttribute(node, nodeGpu->Attributes[0], AccessMode::Read);
|
||||
auto velocity = AccessParticleAttribute(node, nodeGpu->Attributes[1], AccessMode::ReadWrite);
|
||||
auto mass = AccessParticleAttribute(node, nodeGpu->Attributes[2], AccessMode::Read);
|
||||
|
||||
|
||||
const Value attractionSpeed = GetValue(node->GetBox(0), 2).AsFloat();
|
||||
const Value attractionForce = GetValue(node->GetBox(1), 3).AsFloat();
|
||||
const Value stickDistance = GetValue(node->GetBox(2), 4).AsFloat();
|
||||
const Value stickForce = GetValue(node->GetBox(3), 5).AsFloat();
|
||||
|
||||
|
||||
auto param = findOrAddGlobalSDF();
|
||||
_includes.Add(TEXT("./Flax/GlobalSignDistanceField.hlsl"));
|
||||
_writer.Write(
|
||||
@@ -904,7 +904,7 @@ void ParticleEmitterGPUGenerator::ProcessModule(Node* node)
|
||||
), position.Value, velocity.Value, mass.Value, param.ShaderName, attractionSpeed.Value, attractionForce.Value, stickDistance.Value, stickForce.Value);
|
||||
break;
|
||||
}
|
||||
// Collision (Global SDF)
|
||||
// Collision (Global SDF)
|
||||
case 336:
|
||||
{
|
||||
COLLISION_BEGIN();
|
||||
|
||||
@@ -117,7 +117,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupParameters(Box* box, Node* node, V
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Get
|
||||
// Get
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
@@ -188,7 +188,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupParameters(Box* box, Node* node, V
|
||||
value = Value(VariantType::Object, param->ShaderName);
|
||||
break;
|
||||
default:
|
||||
CRASH;
|
||||
CRASH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupTools(Box* box, Node* node, Value&
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Linearize Depth
|
||||
// Linearize Depth
|
||||
case 7:
|
||||
{
|
||||
// Get input
|
||||
@@ -218,11 +218,11 @@ void ParticleEmitterGPUGenerator::ProcessGroupTools(Box* box, Node* node, Value&
|
||||
linearizeSceneDepth(node, depth, value);
|
||||
break;
|
||||
}
|
||||
// Time
|
||||
// Time
|
||||
case 8:
|
||||
value = box->ID == 0 ? Value(VariantType::Float, TEXT("Time")) : Value(VariantType::Float, TEXT("DeltaTime"));
|
||||
break;
|
||||
// Transform Position To Screen UV
|
||||
// Transform Position To Screen UV
|
||||
case 9:
|
||||
{
|
||||
const Value position = tryGetValue(node->GetBox(0), Value::Zero).AsVector3();
|
||||
@@ -242,13 +242,11 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Particle Attribute
|
||||
// Particle Attribute
|
||||
case 100:
|
||||
{
|
||||
value = AccessParticleAttribute(node, (StringView)node->Values[0], static_cast<ParticleAttribute::ValueTypes>(node->Values[1].AsInt), AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Attribute (by index)
|
||||
// Particle Attribute (by index)
|
||||
case 303:
|
||||
{
|
||||
const Char* format;
|
||||
@@ -285,61 +283,43 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
value = writeLocal(type, String::Format(format, attribute.Offset, particleIndex.Value), node);
|
||||
break;
|
||||
}
|
||||
// Particle Position
|
||||
// Particle Position
|
||||
case 101:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Position"), ParticleAttribute::ValueTypes::Vector3, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Lifetime
|
||||
// Particle Lifetime
|
||||
case 102:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Lifetime"), ParticleAttribute::ValueTypes::Float, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Age
|
||||
// Particle Age
|
||||
case 103:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Age"), ParticleAttribute::ValueTypes::Float, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Color
|
||||
// Particle Color
|
||||
case 104:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Color"), ParticleAttribute::ValueTypes::Vector4, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Velocity
|
||||
// Particle Velocity
|
||||
case 105:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Velocity"), ParticleAttribute::ValueTypes::Vector3, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Sprite Size
|
||||
// Particle Sprite Size
|
||||
case 106:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("SpriteSize"), ParticleAttribute::ValueTypes::Vector2, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Mass
|
||||
// Particle Mass
|
||||
case 107:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Mass"), ParticleAttribute::ValueTypes::Float, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Rotation
|
||||
// Particle Rotation
|
||||
case 108:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Rotation"), ParticleAttribute::ValueTypes::Vector3, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Angular Velocity
|
||||
// Particle Angular Velocity
|
||||
case 109:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("AngularVelocity"), ParticleAttribute::ValueTypes::Vector3, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Particle Normalized Age
|
||||
// Particle Normalized Age
|
||||
case 110:
|
||||
{
|
||||
const auto age = AccessParticleAttribute(node, TEXT("Age"), ParticleAttribute::ValueTypes::Float, AccessMode::Read);
|
||||
@@ -347,91 +327,65 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
value = writeOperation2(node, age, lifetime, '/');
|
||||
break;
|
||||
}
|
||||
// Particle Radius
|
||||
// Particle Radius
|
||||
case 111:
|
||||
{
|
||||
value = AccessParticleAttribute(node, TEXT("Radius"), ParticleAttribute::ValueTypes::Float, AccessMode::Read);
|
||||
break;
|
||||
}
|
||||
// Effect Position
|
||||
// Effect Position
|
||||
case 200:
|
||||
{
|
||||
value = Value(VariantType::Vector3, TEXT("EffectPosition"));
|
||||
break;
|
||||
}
|
||||
// Effect Rotation
|
||||
// Effect Rotation
|
||||
case 201:
|
||||
{
|
||||
value = Value(VariantType::Quaternion, TEXT("EffectRotation"));
|
||||
break;
|
||||
}
|
||||
// Effect Scale
|
||||
// Effect Scale
|
||||
case 202:
|
||||
{
|
||||
value = Value(VariantType::Vector3, TEXT("EffectScale"));
|
||||
break;
|
||||
}
|
||||
// Simulation Mode
|
||||
// Simulation Mode
|
||||
case 203:
|
||||
{
|
||||
value = Value(box->ID == 1);
|
||||
break;
|
||||
}
|
||||
// View Position
|
||||
// View Position
|
||||
case 204:
|
||||
{
|
||||
value = Value(VariantType::Vector3, TEXT("ViewPos"));
|
||||
break;
|
||||
}
|
||||
// View Direction
|
||||
// View Direction
|
||||
case 205:
|
||||
{
|
||||
value = Value(VariantType::Vector3, TEXT("ViewDir"));
|
||||
break;
|
||||
}
|
||||
// View Far Plane
|
||||
// View Far Plane
|
||||
case 206:
|
||||
{
|
||||
value = Value(VariantType::Float, TEXT("ViewFar"));
|
||||
break;
|
||||
}
|
||||
// Screen Size
|
||||
// Screen Size
|
||||
case 207:
|
||||
{
|
||||
value = Value(VariantType::Vector2, box->ID == 0 ? TEXT("ScreenSize.xy") : TEXT("ScreenSize.zw"));
|
||||
break;
|
||||
}
|
||||
// Random Float
|
||||
// Random Float
|
||||
case 208:
|
||||
{
|
||||
value = writeLocal(VariantType::Float, TEXT("RAND"), node);
|
||||
break;
|
||||
}
|
||||
// Random Vector2
|
||||
// Random Vector2
|
||||
case 209:
|
||||
{
|
||||
value = writeLocal(VariantType::Vector2, TEXT("RAND2"), node);
|
||||
break;
|
||||
}
|
||||
// Random Vector3
|
||||
// Random Vector3
|
||||
case 210:
|
||||
{
|
||||
value = writeLocal(VariantType::Vector3, TEXT("RAND3"), node);
|
||||
break;
|
||||
}
|
||||
// Random Vector4
|
||||
// Random Vector4
|
||||
case 211:
|
||||
{
|
||||
value = writeLocal(VariantType::Vector4, TEXT("RAND4"), node);
|
||||
break;
|
||||
}
|
||||
// Particle Position (world space)
|
||||
// Particle Position (world space)
|
||||
case 212:
|
||||
value = AccessParticleAttribute(node, TEXT("Position"), ParticleAttribute::ValueTypes::Vector3, AccessMode::Read);
|
||||
if (IsLocalSimulationSpace())
|
||||
value = writeLocal(VariantType::Vector3, String::Format(TEXT("mul(float4({0}, 1), WorldMatrix).xyz"), value.Value), node);
|
||||
break;
|
||||
// Random Float Range
|
||||
// Random Float Range
|
||||
case 213:
|
||||
{
|
||||
auto& a = node->Values[0].AsFloat;
|
||||
@@ -439,7 +393,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
value = writeLocal(VariantType::Float, String::Format(TEXT("lerp({0}, {1}, RAND)"), a, b), node);
|
||||
break;
|
||||
}
|
||||
// Random Vector2 Range
|
||||
// Random Vector2 Range
|
||||
case 214:
|
||||
{
|
||||
auto& a = node->Values[0].AsVector2();
|
||||
@@ -447,7 +401,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
value = writeLocal(VariantType::Vector2, String::Format(TEXT("float2(lerp({0}, {1}, RAND), lerp({2}, {3}, RAND))"), a.X, b.X, a.Y, b.Y), node);
|
||||
break;
|
||||
}
|
||||
// Random Vector3 Range
|
||||
// Random Vector3 Range
|
||||
case 215:
|
||||
{
|
||||
auto& a = node->Values[0].AsVector3();
|
||||
@@ -455,7 +409,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
value = writeLocal(VariantType::Vector3, String::Format(TEXT("float3(lerp({0}, {1}, RAND), lerp({2}, {3}, RAND), lerp({4}, {5}, RAND))"), a.X, b.X, a.Y, b.Y, a.Z, b.Z), node);
|
||||
break;
|
||||
}
|
||||
// Random Vector4 Range
|
||||
// Random Vector4 Range
|
||||
case 216:
|
||||
{
|
||||
auto& a = node->Values[0].AsVector4();
|
||||
@@ -463,7 +417,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
value = writeLocal(VariantType::Vector4, String::Format(TEXT("float4(lerp({0}, {1}, RAND), lerp({2}, {3}, RAND), lerp({4}, {5}, RAND), lerp({6}, {7}, RAND))"), a.X, b.X, a.Y, b.Y, a.Z, b.Z, a.W, b.W), node);
|
||||
break;
|
||||
}
|
||||
// Particle Emitter Function
|
||||
// Particle Emitter Function
|
||||
case 300:
|
||||
{
|
||||
// Load function asset
|
||||
@@ -518,11 +472,11 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
|
||||
_graphStack.Pop();
|
||||
break;
|
||||
}
|
||||
// Particle Index
|
||||
// Particle Index
|
||||
case 301:
|
||||
value = Value(VariantType::Uint, TEXT("context.ParticleIndex"));
|
||||
break;
|
||||
// Particles Count
|
||||
// Particles Count
|
||||
case 302:
|
||||
value = Value(VariantType::Uint, TEXT("context.ParticlesCount"));
|
||||
break;
|
||||
@@ -535,7 +489,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupFunction(Box* box, Node* node, Val
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Function Input
|
||||
// Function Input
|
||||
case 1:
|
||||
{
|
||||
// Find the function call
|
||||
@@ -595,7 +549,6 @@ void ParticleEmitterGPUGenerator::ProcessGroupFunction(Box* box, Node* node, Val
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ bool ParticleEmitterGPUGenerator::sampleSceneTexture(Node* caller, Box* box, con
|
||||
result = Value(VariantType::Float, valueBox->Cache.Value + _subs[3]);
|
||||
break;
|
||||
default:
|
||||
CRASH;
|
||||
CRASH;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupTextures(Box* box, Node* node, Val
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Scene Texture
|
||||
// Scene Texture
|
||||
case 6:
|
||||
{
|
||||
// Get texture type
|
||||
@@ -255,11 +255,11 @@ void ParticleEmitterGPUGenerator::ProcessGroupTextures(Box* box, Node* node, Val
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Scene Depth
|
||||
// Scene Depth
|
||||
case 8:
|
||||
sampleSceneDepth(node, value, box);
|
||||
break;
|
||||
// Texture
|
||||
// Texture
|
||||
case 11:
|
||||
{
|
||||
// Check if texture has been selected
|
||||
@@ -276,7 +276,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupTextures(Box* box, Node* node, Val
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Load Texture
|
||||
// Load Texture
|
||||
case 13:
|
||||
{
|
||||
// Get input texture
|
||||
|
||||
@@ -208,7 +208,7 @@ bool ParticleEmitterGPUGenerator::Generate(WriteStream& source, BytesContainer&
|
||||
typeName = TEXT("uint");
|
||||
break;
|
||||
default:
|
||||
CRASH;
|
||||
CRASH;
|
||||
}
|
||||
_writer.Write(TEXT("// {0:^6} | {1:^6} | {2}\n"), a.Offset, typeName, a.Name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user