本文整理汇总了C#中System.Vector4.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.ToArray方法的具体用法?C# Vector4.ToArray怎么用?C# Vector4.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector4
的用法示例。
在下文中一共展示了Vector4.ToArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public static void Write(this ByteBuffer buffer, int offsetInBytes, Vector4 value)
{
var floats = value.ToArray();
var bytes = new byte[floats.Length * sizeof(float)];
Buffer.BlockCopy(floats, 0, bytes, 0, bytes.Length);
buffer.Write(offsetInBytes, bytes, 0, bytes.Length);
}
示例2: DumpParticles
private void DumpParticles(BabylonScene babylonScene)
{
if (particleSystemsToExport.Count == 0)
return;
babylonScene.particleSystems = new BabylonParticleSystem[particleSystemsToExport.Count];
var index = 0;
foreach (var particleSystem in particleSystemsToExport)
{
babylonScene.particleSystems[index] = new BabylonParticleSystem
{
capacity = particleSystem.BufferSize,
emitterId = particleSystem.Emitter.ID.ToString(),
gravity = particleSystem.Gravity.ToArray(),
direction1 = Vector3.TransformNormal(particleSystem.Direction1, particleSystem.Emitter.LocalMatrix).ToArray(),
direction2 = Vector3.TransformNormal(particleSystem.Direction2, particleSystem.Emitter.LocalMatrix).ToArray(),
minEmitBox = particleSystem.MinEmitBox.ToArray(),
maxEmitBox = particleSystem.MaxEmitBox.ToArray(),
color1 = particleSystem.Color1.ToArray(),
color2 = particleSystem.Color2.ToArray(),
colorDead = new RGBAColor(particleSystem.ColorDead.Red, particleSystem.ColorDead.Green, particleSystem.ColorDead.Blue, particleSystem.DeadAlpha).ToArray(),
emitRate = particleSystem.EmitRate,
updateSpeed = particleSystem.UpdateSpeed,
targetStopFrame = particleSystem.TargetStopFrame,
minEmitPower = particleSystem.MinEmitPower,
maxEmitPower = particleSystem.MaxEmitPower,
minLifeTime = particleSystem.MinLifeTime,
maxLifeTime = particleSystem.MaxLifeTime,
minSize = particleSystem.MinSize,
maxSize = particleSystem.MaxSize,
minAngularSpeed = particleSystem.MinAngularSpeed,
maxAngularSpeed = particleSystem.MaxAngularSpeed,
textureName = CopyTexture(particleSystem.Texture, babylonScene),
blendMode = (int)particleSystem.BlendType,
linkToEmitter = particleSystem.LinkToEmitter
};
Vector4 textureMask = Vector4.Zero;
switch (particleSystem.TextureUsage)
{
case NovaParticleSystem.ParticleTextureUsages.Alpha:
textureMask = new Vector4(0, 0, 0, 1);
break;
case NovaParticleSystem.ParticleTextureUsages.RGB:
textureMask = new Vector4(1, 1, 1, 0);
break;
case NovaParticleSystem.ParticleTextureUsages.ARGB:
textureMask = new Vector4(1, 1, 1, 1);
break;
}
babylonScene.particleSystems[index].textureMask = textureMask.ToArray();
index++;
}
}