Skip to content

Instantly share code, notes, and snippets.

@kg
Created June 10, 2019 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kg/afee405b18b3ade30a12e7ab31324631 to your computer and use it in GitHub Desktop.
Save kg/afee405b18b3ade30a12e7ab31324631 to your computer and use it in GitHub Desktop.
Automatic code generation
// Machine-generated from 'C:\Users\Katelyn\Desktop\particle demo\bear.lumined'
using System;
using Squared.Illuminant.Particles;
using Microsoft.Xna.Framework;
using C_RS = Squared.Render.Convenience.RenderStates;
using G_BS = Microsoft.Xna.Framework.Graphics.BlendState;
namespace Squared.Illuminant.Compiled {
public class @Bear : IDisposable {
public bool IsDisposed { get; private set; }
public readonly ParticleEngine Engine;
public readonly ParticleSystem Sparks;
public readonly ParticleSystem Smoke;
public @Bear (ParticleEngine engine) {
ParticleSystem s;
Engine = engine;
var SparksConfiguration = new ParticleSystemConfiguration {
Appearance = {
OffsetPx = new Vector2(0f, 0f),
AnimationRate = new Vector2(0f, 0f),
Rounded = true,
RoundingPowerFromLife = new BezierF {
A = 0.4399991f,
B = 0f,
C = 0f,
D = 0f,
Count = 1, Mode = BezierTimeMode.Once,
MinValue = 0f, MaxValue = 1f
},
Bilinear = true,
RelativeSize = true,
RowFromVelocity = false,
ColumnFromVelocity = false,
}
,
Color = {
FromLife = new Bezier4 {
A = new Vector4(0.24f, 0.1200001f, 0f, 1f),
B = new Vector4(0.5200002f, 0.22f, -0.01f, 1f),
C = new Vector4(0.7600003f, 0.6600002f, 1.043081E-07f, 1f),
D = new Vector4(1f, 0.9399998f, 0.6600001f, 1.000001f),
Count = 4, Mode = BezierTimeMode.Once,
MinValue = 0f, MaxValue = 70.72f
},
Global = new Vector4(1f, 1f, 1f, 1f),
}
,
Size = new Vector2(3.419999f, 2.059999f),
LifeDecayPerSecond = 98f,
Collision = {
Distance = 0.33f,
LifePenalty = 0f,
EscapeVelocity = 128f,
BounceVelocityMultiplier = 0f,
}
,
MaximumVelocity = 9999f,
Friction = 0.9000001f,
ZToY = 0f,
StippleFactor = 1f,
RotationFromVelocity = true,
RotationFromLife = 0f,
RotationFromIndex = 0f,
AutoReadback = false,
SortedReadback = true,
};
Sparks = new ParticleSystem(engine, SparksConfiguration);
var SmokeConfiguration = new ParticleSystemConfiguration {
Appearance = {
Texture = { Name = "puff.png" },
OffsetPx = new Vector2(0f, 0f),
AnimationRate = new Vector2(0f, 0f),
Rounded = false,
RoundingPowerFromLife = new BezierF {
A = 0.5000003f,
B = 0f,
C = 0f,
D = 0f,
Count = 1, Mode = BezierTimeMode.Once,
MinValue = 0f, MaxValue = 1f
},
Bilinear = true,
RelativeSize = false,
RowFromVelocity = false,
ColumnFromVelocity = false,
}
,
Color = {
FromLife = new Bezier4 {
A = new Vector4(0.5800001f, 0.5600001f, 0.4800002f, 0.4400004f),
B = new Vector4(0.42f, 0.24f, 0.1f, 0.2600001f),
C = new Vector4(0.1400005f, 0.06000012f, 0.02000003f, 1.490116E-07f),
D = new Vector4(0f, 0f, 0f, 0f),
Count = 3, Mode = BezierTimeMode.Once,
MinValue = 100.62f, MaxValue = 3.119999f
},
Global = new Vector4(1f, 1f, 1f, 1f),
}
,
Size = new Vector2(1f, 1f),
SizeFromLife = new BezierF {
A = 0.5600024f,
B = 15.2f,
C = 0f,
D = 0f,
Count = 2, Mode = BezierTimeMode.Once,
MinValue = 128f, MaxValue = 0f
},
LifeDecayPerSecond = 41f,
Collision = {
Distance = 0.33f,
LifePenalty = 0f,
EscapeVelocity = 128f,
BounceVelocityMultiplier = 0f,
}
,
MaximumVelocity = 9999f,
Friction = 0f,
ZToY = 0f,
StippleFactor = 1f,
RotationFromVelocity = false,
RotationFromLife = -0.18f,
RotationFromIndex = 0.2500012f,
AutoReadback = false,
SortedReadback = true,
};
Smoke = new ParticleSystem(engine, SmokeConfiguration);
Sparks.Transforms.Add(new Particles.Transforms.Spawner {
MinRate = new Configuration.Parameter<Single>("Sparks.Rate", (t) => @SparksRate.Evaluate(t)),
MaxRate = new Configuration.Parameter<Single>("Sparks.Rate", (t) => @SparksRate.Evaluate(t)),
Position = new Formula3 {
Constant = new Vector3(1.28566f, 2.015545f, 0f),
Offset = new Vector3(0f, 0f, 0f),
RandomScale = new Vector3(4.449998f, 4.4f, 0f),
Type = FormulaType.Spherical
},
Velocity = new Formula3 {
Constant = new Configuration.Parameter<Vector3>("Velocity.Constant", (t) => @VelocityConstant.Evaluate(t)),
Offset = new Vector3(0f, 0f, 0f),
RandomScale = new Vector3(16.47093f, 29.08356f, 0f),
Type = FormulaType.Towards
},
Life = new Formula1 {
Constant = 73f,
Offset = 0f,
RandomScale = 0f
},
Color = new Formula4 {
Constant = new Vector4(1f, 1f, 1f, 1f),
Offset = new Vector4(0f, 0f, 0f, 0f),
RandomScale = new Vector4(0f, 0f, 0f, 0f)
},
});
Smoke.Transforms.Add(new Particles.Transforms.FeedbackSpawner {
MinRate = 25.5f,
MaxRate = 32.5f,
Life = new Formula1 {
Constant = 131f,
Offset = 0f,
RandomScale = 0f
},
Position = new Formula3 {
Constant = new Vector3(0f, 0f, 0f),
Offset = new Vector3(0f, 0f, 0f),
RandomScale = new Vector3(0f, 0f, 0f),
Type = FormulaType.Spherical
},
Velocity = new Formula3 {
Constant = new Vector3(0f, -15.74f, 0f),
Offset = new Vector3(-0.51f, 0f, 0f),
RandomScale = new Vector3(5.019998f, 0f, 0f),
Type = FormulaType.Linear
},
Color = new Formula4 {
Constant = new Vector4(1f, 1f, 1f, 1f),
Offset = new Vector4(0f, 0f, 0f, 0f),
RandomScale = new Vector4(0f, 0f, 0f, 0f)
},
SourceSystem = @Sparks,
SlidingWindowMargin = 18,
AlignPositionConstant = true,
SourceVelocityFactor = 0.3999999f,
InstanceMultiplier = 0,
AlphaDiscardThreshold = 0.05f,
SlidingWindowSize = 37,
MultiplyColorConstant = false,
});
}
public Bezier3 @VelocityConstant =
new Bezier3 {
A = new Vector3(-36.10164f, -67.20737f, 0f),
B = new Vector3(37.97836f, -67.20737f, 0f),
C = new Vector3(0f, 0f, 0f),
D = new Vector3(0f, 0f, 0f),
Count = 2, Mode = BezierTimeMode.BounceSin,
MinValue = 0f, MaxValue = 7.549999f
};
public BezierF @SparksRate =
new BezierF {
A = 14.7f,
B = 0.9999948f,
C = 120.1f,
D = 135.1f,
Count = 4, Mode = BezierTimeMode.BounceExp,
MinValue = 0f, MaxValue = 9.619999f
};
public Vector4 @Var1 =
new Vector4(0f, 0f, 0f, 0f);
public Single @Var2 =
0f;
public void Update (Render.IBatchContainer container, ref int layer) {
Smoke.Update(container, layer++);
Sparks.Update(container, layer++);
}
public void Render (Render.IBatchContainer container, ref int layer, Render.Material material = null, Matrix? transform = null, G_BS blendState = null, ParticleRenderParameters renderParams = null, bool usePreviousData = false) {
var SmokeBlendState = blendState ?? G_BS.AlphaBlend;
Smoke.Render(container, layer++, material: material, transform: transform, blendState: SmokeBlendState, renderParams: renderParams, usePreviousData: usePreviousData);
var SparksBlendState = blendState ?? C_RS.AdditiveBlend;
Sparks.Render(container, layer++, material: material, transform: transform, blendState: SparksBlendState, renderParams: renderParams, usePreviousData: usePreviousData);
}
public void Dispose () {
if (IsDisposed)
return;
IsDisposed = true;
Sparks.Dispose();
Smoke.Dispose();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment