From e56b280f5b4d10028d340e2bf8a3178f73a6ef9e Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Mon, 28 Mar 2022 14:01:29 +0200 Subject: [PATCH] Format code for shader generators --- ...rticleEmitterGraph.CPU.ParticleModules.cpp | 74 +++++------ .../ParticleEmitterGraph.CPU.Particles.cpp | 68 +++++----- .../Graph/CPU/ParticleEmitterGraph.CPU.cpp | 12 +- ...rticleEmitterGraph.GPU.ParticleModules.cpp | 68 +++++----- .../ParticleEmitterGraph.GPU.Particles.cpp | 125 ++++++------------ .../GPU/ParticleEmitterGraph.GPU.Textures.cpp | 10 +- .../Graph/GPU/ParticleEmitterGraph.GPU.cpp | 2 +- .../MaterialGenerator.Layers.cpp | 14 +- .../MaterialGenerator.Material.cpp | 84 ++++++------ .../MaterialGenerator.Parameters.cpp | 2 +- .../MaterialGenerator.Particles.cpp | 26 ++-- .../MaterialGenerator.Textures.cpp | 20 +-- .../MaterialGenerator.Tools.cpp | 10 +- 13 files changed, 234 insertions(+), 281 deletions(-) diff --git a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.ParticleModules.cpp b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.ParticleModules.cpp index e37378a3a..986072fa3 100644 --- a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.ParticleModules.cpp +++ b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.ParticleModules.cpp @@ -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 diff --git a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp index 9f887503d..0e7eec882 100644 --- a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp +++ b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp @@ -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 diff --git a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.cpp b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.cpp index 1338ee64a..12211de41 100644 --- a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.cpp +++ b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.cpp @@ -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 diff --git a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.ParticleModules.cpp b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.ParticleModules.cpp index 36a10a522..c267eea05 100644 --- a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.ParticleModules.cpp +++ b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.ParticleModules.cpp @@ -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(); diff --git a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Particles.cpp b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Particles.cpp index 7b4dfefb1..7e6b081ed 100644 --- a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Particles.cpp +++ b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Particles.cpp @@ -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(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; } diff --git a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp index 1f1166418..46a25560f 100644 --- a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp +++ b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp @@ -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 diff --git a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp index d1c55021b..2b0e5b8e6 100644 --- a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp +++ b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp @@ -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); } diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Layers.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Layers.cpp index d36168d1a..def7d7ee8 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Layers.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Layers.cpp @@ -8,7 +8,7 @@ void MaterialGenerator::ProcessGroupLayers(Box* box, Node* node, Value& value) { switch (node->TypeID) { - // Sample Layer + // Sample Layer case 1: { Guid id = (Guid)node->Values[0]; @@ -141,7 +141,7 @@ void MaterialGenerator::ProcessGroupLayers(Box* box, Node* node, Value& value) value = MaterialValue(VariantType::Void, varName); break; } - // Blend Linear + // Blend Linear case 2: case 5: case 8: @@ -215,8 +215,8 @@ void MaterialGenerator::ProcessGroupLayers(Box* box, Node* node, Value& value) #undef EAT_BOX break; } - // Pack Material Layer (old: without TessellationMultiplier, SubsurfaceColor and WorldDisplacement support) - // [Deprecated on 2018.10.01, expires on 2019.10.01] + // Pack Material Layer (old: without TessellationMultiplier, SubsurfaceColor and WorldDisplacement support) + // [Deprecated on 2018.10.01, expires on 2019.10.01] case 3: { // Create new layer @@ -263,8 +263,8 @@ void MaterialGenerator::ProcessGroupLayers(Box* box, Node* node, Value& value) break; } - // Unpack Material Layer - // Node type 4 -> [Deprecated on 2018.10.01, expires on 2019.10.01] + // Unpack Material Layer + // Node type 4 -> [Deprecated on 2018.10.01, expires on 2019.10.01] case 4: case 7: { @@ -284,7 +284,7 @@ void MaterialGenerator::ProcessGroupLayers(Box* box, Node* node, Value& value) } break; } - // Pack Material Layer + // Pack Material Layer case 6: { // Create new layer diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp index 5809cb267..65718c4b3 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp @@ -9,24 +9,24 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) { switch (node->TypeID) { - // World Position + // World Position case 2: value = Value(VariantType::Vector3, TEXT("input.WorldPosition.xyz")); break; - // View + // View case 3: { switch (box->ID) { - // Position + // Position case 0: value = Value(VariantType::Vector3, TEXT("ViewPos")); break; - // Direction + // Direction case 1: value = Value(VariantType::Vector3, TEXT("ViewDir")); break; - // Far Plane + // Far Plane case 2: value = Value(VariantType::Float, TEXT("ViewFar")); break; @@ -34,15 +34,15 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) } break; } - // Normal + // Normal case 4: value = getNormal; break; - // Camera Vector + // Camera Vector case 5: value = getCameraVector(node); break; - // Screen Position + // Screen Position case 6: { // Position @@ -54,11 +54,11 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) break; } - // Screen Size + // Screen Size case 7: value = Value(VariantType::Vector2, box->ID == 0 ? TEXT("ScreenSize.xy") : TEXT("ScreenSize.zw")); break; - // Custom code + // Custom code case 8: { // Skip if has no code @@ -127,15 +127,15 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = box->Cache; break; } - // Object Position + // Object Position case 9: value = Value(VariantType::Vector3, TEXT("GetObjectPosition(input)")); break; - // Two Sided Sign + // Two Sided Sign case 10: value = Value(VariantType::Float, TEXT("input.TwoSidedSign")); break; - // Camera Depth Fade + // Camera Depth Fade case 11: { auto faeLength = tryGetValue(node->GetBox(0), node->Values[0]).AsFloat(); @@ -152,40 +152,40 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = x5; break; } - // Vertex Color + // Vertex Color case 12: value = getVertexColor; _treeLayer->UsageFlags |= MaterialUsageFlags::UseVertexColor; break; - // Pre-skinned Local Position + // Pre-skinned Local Position case 13: value = _treeType == MaterialTreeType::VertexShader ? Value(VariantType::Vector3, TEXT("input.PreSkinnedPosition")) : Value::Zero; break; - // Pre-skinned Local Normal + // Pre-skinned Local Normal case 14: value = _treeType == MaterialTreeType::VertexShader ? Value(VariantType::Vector3, TEXT("input.PreSkinnedNormal")) : Value::Zero; break; - // Depth + // Depth case 15: value = writeLocal(VariantType::Float, TEXT("distance(ViewPos, input.WorldPosition)"), node); break; - // Tangent + // Tangent case 16: value = Value(VariantType::Vector3, TEXT("input.TBN[0]")); break; - // Bitangent + // Bitangent case 17: value = Value(VariantType::Vector3, TEXT("input.TBN[1]")); break; - // Camera Position + // Camera Position case 18: value = Value(VariantType::Vector3, TEXT("ViewPos")); break; - // Per Instance Random + // Per Instance Random case 19: value = Value(VariantType::Float, TEXT("GetPerInstanceRandom(input)")); break; - // Interpolate VS To PS + // Interpolate VS To PS case 20: { const auto input = node->GetBox(0); @@ -219,7 +219,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) _vsToPsInterpolants.Add(input); break; } - // Terrain Holes Mask + // Terrain Holes Mask case 21: { MaterialLayer* baseLayer = GetRootLayer(); @@ -229,7 +229,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = Value::One; break; } - // Terrain Layer Weight + // Terrain Layer Weight case 22: { MaterialLayer* baseLayer = GetRootLayer(); @@ -252,7 +252,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = Value(VariantType::Float, String::Format(TEXT("input.Layers[{0}][{1}]"), slotIndex, componentIndex)); break; } - // Depth Fade + // Depth Fade case 23: { // Calculate screen-space UVs @@ -278,7 +278,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = writeLocal(VariantType::Float, String::Format(TEXT("saturate({0} / {1})"), depthDiff.Value, fadeDistance.Value), node); break; } - // Material Function + // Material Function case 24: { // Load function asset @@ -333,11 +333,11 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) _graphStack.Pop(); break; } - // Object Size + // Object Size case 25: value = Value(VariantType::Vector3, TEXT("GetObjectSize(input)")); break; - // Blend Normals + // Blend Normals case 26: { const auto baseNormal = tryGetValue(node->GetBox(0), getNormalZero).AsVector3(); @@ -350,7 +350,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = writeLocal(ValueType::Vector3, text2, node); break; } - // Rotator + // Rotator case 27: { const auto uv = tryGetValue(node->GetBox(0), getUVs).AsVector2(); @@ -366,7 +366,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = writeLocal(ValueType::Vector2, String::Format(TEXT("{3} + float2(dot({0},{1}), dot({0},{2}))"), x1.Value, dotB1.Value, dotB2.Value, center.Value), node); break; } - // Sphere Mask + // Sphere Mask case 28: { const auto a = tryGetValue(node->GetBox(0), 0, Value::Zero); @@ -384,7 +384,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = writeLocal(ValueType::Float, String::Format(TEXT("{0} ? (1 - {1}) : {1}"), invert.Value, x2.Value), node); break; } - // Tiling & Offset + // Tiling & Offset case 29: { const auto uv = tryGetValue(node->GetBox(0), getUVs).AsVector2(); @@ -394,42 +394,42 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = writeLocal(ValueType::Vector2, String::Format(TEXT("{0} * {1} + {2}"), uv.Value, tiling.Value, offset.Value), node); break; } - // DDX + // DDX case 30: { const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero); value = writeLocal(inValue.Type, String::Format(TEXT("ddx({0})"), inValue.Value), node); break; } - // DDY + // DDY case 31: { const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero); value = writeLocal(inValue.Type, String::Format(TEXT("ddy({0})"), inValue.Value), node); break; } - // Sign + // Sign case 32: { const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero); value = writeLocal(ValueType::Float, String::Format(TEXT("sign({0})"), inValue.Value), node); break; } - // Any + // Any case 33: { const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero); value = writeLocal(ValueType::Bool, String::Format(TEXT("any({0})"), inValue.Value), node); break; } - // All + // All case 34: { const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero); value = writeLocal(ValueType::Bool, String::Format(TEXT("all({0})"), inValue.Value), node); break; } - // Blackbody + // Blackbody case 35: { // Reference: Mitchell Charity, http://www.vendian.org/mncharity/dir3/blackbody/ @@ -451,7 +451,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = writeLocal(ValueType::Vector3, String::Format(TEXT("{1} < 1000.0f ? {0} * {1}/1000.0f : {0}"), color.Value, temperature.Value), node); break; } - // HSVToRGB + // HSVToRGB case 36: { const auto hsv = tryGetValue(node->GetBox(0), node->Values[0]).AsVector3(); @@ -463,7 +463,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) value = writeLocal(ValueType::Vector3, String::Format(TEXT("{1}.z * lerp(float3(1.0, 1.0, 1.0), {0}, {1}.y)"), x1.Value, color.Value), node); break; } - // RGBToHSV + // RGBToHSV case 37: { // Reference: Ian Taylor, https://www.chilliant.com/rgb2hsv.html @@ -474,8 +474,8 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value) auto p = writeLocal(ValueType::Vector4, String::Format(TEXT("({0}.g < {0}.b) ? float4({0}.bg, -1.0f, 2.0f/3.0f) : float4({0}.gb, 0.0f, -1.0f/3.0f)"), rgb.Value), node); auto q = writeLocal(ValueType::Vector4, String::Format(TEXT("({0}.r < {1}.x) ? float4({1}.xyw, {0}.r) : float4({0}.r, {1}.yzx)"), rgb.Value, p.Value), node); auto c = writeLocal(ValueType::Float, String::Format(TEXT("{0}.x - min({0}.w, {0}.y)"), q.Value), node); - auto h = writeLocal(ValueType::Float , String::Format(TEXT("abs(({0}.w - {0}.y) / (6 * {1} + {2}) + {0}.z)"), q.Value, c.Value, epsilon.Value), node); - + auto h = writeLocal(ValueType::Float, String::Format(TEXT("abs(({0}.w - {0}.y) / (6 * {1} + {2}) + {0}.z)"), q.Value, c.Value, epsilon.Value), node); + auto hcv = writeLocal(ValueType::Vector3, String::Format(TEXT("float3({0}, {1}, {2}.x)"), h.Value, c.Value, q.Value), node); value = writeLocal(ValueType::Vector3, String::Format(TEXT("float3({0}.x * 360.0f, {0}.y / ({0}.z + {1}), {0}.z)"), hcv.Value, epsilon.Value), node); break; @@ -489,7 +489,7 @@ void MaterialGenerator::ProcessGroupFunction(Box* box, Node* node, Value& value) { switch (node->TypeID) { - // Function Input + // Function Input case 1: { // Find the function call diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Parameters.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Parameters.cpp index a19b9ea42..67bb3d84d 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Parameters.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Parameters.cpp @@ -8,7 +8,7 @@ void MaterialGenerator::ProcessGroupParameters(Box* box, Node* node, Value& valu { switch (node->TypeID) { - // Get + // Get case 1: { // Get parameter diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Particles.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Particles.cpp index 76c0d9fa9..ec3ea3777 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Particles.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Particles.cpp @@ -99,74 +99,74 @@ void MaterialGenerator::ProcessGroupParticles(Box* box, Node* node, Value& value switch (node->TypeID) { - // Particle Attribute + // Particle Attribute case 100: { value = AccessParticleAttribute(node, (StringView)node->Values[0], static_cast(node->Values[1].AsInt)); break; } - // Particle Attribute (by index) + // Particle Attribute (by index) case 303: { const auto particleIndex = Value::Cast(tryGetValue(node->GetBox(1), Value(VariantType::Uint, TEXT("input.ParticleIndex"))), VariantType::Uint); value = AccessParticleAttribute(node, (StringView)node->Values[0], static_cast(node->Values[1].AsInt), particleIndex.Value.Get()); break; } - // Particle Position + // Particle Position case 101: { value = AccessParticleAttribute(node, TEXT("Position"), ParticleAttributeValueTypes::Vector3, nullptr, ParticleAttributeSpace::LocalPosition); break; } - // Particle Lifetime + // Particle Lifetime case 102: { value = AccessParticleAttribute(node, TEXT("Lifetime"), ParticleAttributeValueTypes::Float); break; } - // Particle Age + // Particle Age case 103: { value = AccessParticleAttribute(node, TEXT("Age"), ParticleAttributeValueTypes::Float); break; } - // Particle Color + // Particle Color case 104: { value = AccessParticleAttribute(node, TEXT("Color"), ParticleAttributeValueTypes::Vector4); break; } - // Particle Velocity + // Particle Velocity case 105: { value = AccessParticleAttribute(node, TEXT("Velocity"), ParticleAttributeValueTypes::Vector3, nullptr, ParticleAttributeSpace::LocalDirection); break; } - // Particle Sprite Size + // Particle Sprite Size case 106: { value = AccessParticleAttribute(node, TEXT("SpriteSize"), ParticleAttributeValueTypes::Vector2); break; } - // Particle Mass + // Particle Mass case 107: { value = AccessParticleAttribute(node, TEXT("Mass"), ParticleAttributeValueTypes::Float); break; } - // Particle Rotation + // Particle Rotation case 108: { value = AccessParticleAttribute(node, TEXT("Rotation"), ParticleAttributeValueTypes::Vector3); break; } - // Particle Angular Velocity + // Particle Angular Velocity case 109: { value = AccessParticleAttribute(node, TEXT("AngularVelocity"), ParticleAttributeValueTypes::Vector3); break; } - // Particle Normalized Age + // Particle Normalized Age case 110: { const auto age = AccessParticleAttribute(node, TEXT("Age"), ParticleAttributeValueTypes::Float); @@ -174,7 +174,7 @@ void MaterialGenerator::ProcessGroupParticles(Box* box, Node* node, Value& value value = writeOperation2(node, age, lifetime, '/'); break; } - // Particle Radius + // Particle Radius case 111: { value = AccessParticleAttribute(node, TEXT("Radius"), ParticleAttributeValueTypes::Float); diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp index 7ed372a32..44b8805d0 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp @@ -8,7 +8,7 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) { switch (node->TypeID) { - // Texture + // Texture case 1: { // Check if texture has been selected @@ -28,11 +28,11 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) } break; } - // TexCoord + // TexCoord case 2: value = getUVs; break; - // Cube Texture + // Cube Texture case 3: { // Check if texture has been selected @@ -52,7 +52,7 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) } break; } - // Normal Map + // Normal Map case 4: { // Check if texture has been selected @@ -72,7 +72,7 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) } break; } - // Parallax Occlusion Mapping + // Parallax Occlusion Mapping case 5: { auto heightTextureBox = node->GetBox(4); @@ -163,7 +163,7 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) value = result; break; } - // Scene Texture + // Scene Texture case 6: { // Get texture type @@ -267,7 +267,7 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) } break; } - // Scene Color + // Scene Color case 7: { // Sample scene color texture @@ -275,13 +275,13 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) sampleTexture(node, value, box, ¶m); break; } - // Scene Depth + // Scene Depth case 8: { sampleSceneDepth(node, value, box); break; } - // Sample Texture + // Sample Texture case 9: { enum CommonSamplerType @@ -401,7 +401,7 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) value = textureBox->Cache; break; } - // Flipbook + // Flipbook case 10: { // Get input values diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Tools.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Tools.cpp index 1c5160593..21a9e6ec0 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Tools.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Tools.cpp @@ -8,7 +8,7 @@ void MaterialGenerator::ProcessGroupTools(Box* box, Node* node, Value& value) { switch (node->TypeID) { - // Fresnel + // Fresnel case 1: case 4: { @@ -33,7 +33,7 @@ void MaterialGenerator::ProcessGroupTools(Box* box, Node* node, Value& value) value = local6; break; } - // Desaturation + // Desaturation case 2: { // Get inputs @@ -46,13 +46,13 @@ void MaterialGenerator::ProcessGroupTools(Box* box, Node* node, Value& value) value = writeFunction3(node, input, dot, scale, TEXT("lerp"), VariantType::Vector3); break; } - // Time + // Time case 3: { value = getTime; break; } - // Panner + // Panner case 6: { // Get inputs @@ -68,7 +68,7 @@ void MaterialGenerator::ProcessGroupTools(Box* box, Node* node, Value& value) value = writeOperation2(node, uv, local1, '+'); break; } - // Linearize Depth + // Linearize Depth case 7: { // Get input