本文整理汇总了C#中Vector4F类的典型用法代码示例。如果您正苦于以下问题:C# Vector4F类的具体用法?C# Vector4F怎么用?C# Vector4F使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector4F类属于命名空间,在下文中一共展示了Vector4F类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AdditionOperator
public void AdditionOperator()
{
Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
Vector4F b = new Vector4F(2.0f, 3.0f, 4.0f, 5.0f);
Vector4F c = a + b;
Assert.AreEqual(new Vector4F(3.0f, 5.0f, 7.0f, 9.0f), c);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:Vector4FTest.cs
示例2: Addition
public void Addition()
{
Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
Vector4F b = new Vector4F(2.0f, 3.0f, 4.0f, 5.0f);
Vector4F c = Vector4F.Add(a, b);
Assert.AreEqual(new Vector4F(3.0f, 5.0f, 7.0f, 9.0f), c);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:Vector4FTest.cs
示例3: Normalize
public void Normalize()
{
Vector4F v, n1, n2;
float magnitude;
v = new Vector4F(3.0f, 4.0f, 0.0f, 0.0f);
n1 = v.Normalize();
n2 = v.Normalize(out magnitude);
Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
Assert.AreEqual(5.0f, magnitude, 1e-14);
v = new Vector4F(3.0f, 0.0f, 4.0f, 0.0f);
n1 = v.Normalize();
n2 = v.Normalize(out magnitude);
Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
Assert.AreEqual(5.0f, magnitude, 1e-14);
v = new Vector4F(0.0f, 3.0f, 4.0f, 0.0f);
n1 = v.Normalize();
n2 = v.Normalize(out magnitude);
Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
Assert.AreEqual(5.0f, magnitude, 1e-14);
v = new Vector4F(0.0f, 0.0f, 3.0f, 4.0f);
n1 = v.Normalize();
n2 = v.Normalize(out magnitude);
Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
Assert.AreEqual(5.0f, magnitude, 1e-14);
}
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:33,代码来源:Vector4FTests.cs
示例4: CascadedShadow
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="CascadedShadow"/> class.
/// </summary>
public CascadedShadow()
{
NumberOfCascades = 4;
Distances = new Vector4F(4, 12, 20, 80);
MinLightDistance = 100;
DepthBias = new Vector4F(5);
NormalOffset = new Vector4F(2);
NumberOfSamples = -1;
FilterRadius = 1;
JitterResolution = 2048;
FadeOutRange = 0.1f;
ShadowFog = 0;
#if XBOX
CascadeSelection = ShadowCascadeSelection.Fast;
#else
CascadeSelection = ShadowCascadeSelection.Best;
#endif
IsCascadeLocked = new[] { false, false, false, false };
#pragma warning disable 618
SplitDistribution = 0.9f;
FadeOutDistance = 50;
MaxDistance = 70;
DepthBiasScale = new Vector4F(0.99f);
DepthBiasOffset = new Vector4F(-0.001f);
#pragma warning restore 618
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:30,代码来源:CascadedShadow.cs
示例5: GradientTextureSkyNode
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="GradientTextureSkyNode" /> class.
/// </summary>
public GradientTextureSkyNode()
{
SunDirection = new Vector3F(1, 1, 1);
TimeOfDay = new TimeSpan(12, 0, 0);
Color = new Vector4F(1, 1, 1, 1);
CieSkyParameters = CieSkyParameters.Type12;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:11,代码来源:GradientTextureSkyNode.cs
示例6: Construct2
public void Construct2()
{
Vector4F v = new Vector4F(new Vector2F(1.0f, 2.0f), 3.0f, 4.0f);
Assert.AreEqual(1.0f, v.X);
Assert.AreEqual(2.0f, v.Y);
Assert.AreEqual(3.0f, v.Z);
Assert.AreEqual(4.0f, v.W);
}
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:8,代码来源:Vector4FTests.cs
示例7: VectorMultiply
public static Vector4F VectorMultiply(Matrix4x4F a, Vector4F b)
{
return new Vector4F(
a.M11 * b.X + a.M21 * b.Y + a.M31 * b.Z + a.M41 * b.W,
a.M12 * b.X + a.M22 * b.Y + a.M32 * b.Z + a.M42 * b.W,
a.M13 * b.X + a.M23 * b.Y + a.M33 * b.Z + a.M43 * b.W,
a.M14 * b.X + a.M24 * b.Y + a.M34 * b.Z + a.M44 * b.W
);
}
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:9,代码来源:Matrix.cs
示例8: Fog
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="Fog"/> class.
/// </summary>
public Fog()
{
Density = 1f;
Height0 = 0;
Color0 = new Vector4F(0.5f, 0.5f, 0.5f, 1);
Height1 = 100;
Color1 = new Vector4F(0.5f, 0.5f, 0.5f, 1);
HeightFalloff = 0;
Start = 0;
End = 50;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:15,代码来源:Fog.cs
示例9: Terrain
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="Terrain"/> class.
/// </summary>
public Terrain()
{
InvalidBaseRegions = new List<Aabb>();
InvalidDetailRegions = new List<Aabb>();
Shape = Shape.Infinite;
BaseClearValues = new Vector4F[4];
DetailClearValues = new Vector4F[4];
BaseClearValues[0] = new Vector4F(-10000, 0, 0, 1);
Tiles = new TerrainTileCollection(this);
Aabb = new Aabb();
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:17,代码来源:Terrain.cs
示例10: GradientSkyNode
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="GradientSkyNode" /> class.
/// </summary>
public GradientSkyNode()
{
SunDirection = new Vector3F(1, 1, 1);
FrontColor = new Vector4F(0.9f, 0.5f, 0, 1);
ZenithColor = new Vector4F(0, 0.4f, 0.9f, 1);
BackColor = new Vector4F(0.4f, 0.6f, 0.9f, 1);
GroundColor = new Vector4F(1, 0.8f, 0.6f, 1);
FrontZenithShift = 0.5f;
BackZenithShift = 0.5f;
FrontGroundShift = 0.5f;
BackGroundShift = 0.5f;
CieSkyParameters = CieSkyParameters.Type12;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:18,代码来源:GradientSkyNode.cs
示例11: AreEqual
public void AreEqual()
{
float originalEpsilon = Numeric.EpsilonF;
Numeric.EpsilonF = 1e-8f;
Vector4F u = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
Vector4F v = new Vector4F(1.000001f, 2.000001f, 3.000001f, 4.000001f);
Vector4F w = new Vector4F(1.00000001f, 2.00000001f, 3.00000001f, 4.00000001f);
Assert.IsTrue(Vector4F.AreNumericallyEqual(u, u));
Assert.IsFalse(Vector4F.AreNumericallyEqual(u, v));
Assert.IsTrue(Vector4F.AreNumericallyEqual(u, w));
Numeric.EpsilonF = originalEpsilon;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:15,代码来源:Vector4FTest.cs
示例12: Absolute
public void Absolute()
{
Vector4F v = new Vector4F(-1, -2, -3, -4);
v.Absolute();
Assert.AreEqual(1, v.X);
Assert.AreEqual(2, v.Y);
Assert.AreEqual(3, v.Z);
Assert.AreEqual(4, v.W);
v = new Vector4F(1, 2, 3, 4);
v.Absolute();
Assert.AreEqual(1, v.X);
Assert.AreEqual(2, v.Y);
Assert.AreEqual(3, v.Z);
Assert.AreEqual(4, v.W);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:17,代码来源:Vector4FTest.cs
示例13: FigureNode
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="FigureNode" /> class.
/// </summary>
/// <param name="figure">The figure.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="figure"/> is <see langword="null"/>.
/// </exception>
public FigureNode(Figure figure)
{
if (figure == null)
throw new ArgumentNullException("figure");
IsRenderable = true;
_figure = figure;
Shape = figure.BoundingShape;
StrokeColor = new Vector3F(1, 1, 1);
StrokeAlpha = 1;
StrokeThickness = 1;
StrokeDashPattern = new Vector4F(1, 0, 0, 0);
DashInWorldSpace = true;
FillColor = new Vector3F(1, 1, 1);
FillAlpha = 1;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:25,代码来源:FigureNode.cs
示例14: AbsoluteStatic
public void AbsoluteStatic()
{
Vector4F v = new Vector4F(-1, -2, -3, -4);
Vector4F absoluteV = Vector4F.Absolute(v);
Assert.AreEqual(1, absoluteV.X);
Assert.AreEqual(2, absoluteV.Y);
Assert.AreEqual(3, absoluteV.Z);
Assert.AreEqual(4, absoluteV.W);
v = new Vector4F(1, 2, 3, 4);
absoluteV = Vector4F.Absolute(v);
Assert.AreEqual(1, absoluteV.X);
Assert.AreEqual(2, absoluteV.Y);
Assert.AreEqual(3, absoluteV.Z);
Assert.AreEqual(4, absoluteV.W);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:17,代码来源:Vector4FTest.cs
示例15: Magnitude
public void Magnitude()
{
Vector4F v = new Vector4F(3.0f, 4.0f, 0.0f, 0.0f);
Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
Assert.AreEqual(5.0f, v.Magnitude, 1e-14);
v = new Vector4F(3.0f, 0.0f, 4.0f, 0.0f);
Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
Assert.AreEqual(5.0f, v.Magnitude, 1e-14);
v = new Vector4F(0.0f, 3.0f, 4.0f, 0.0f);
Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
Assert.AreEqual(5.0f, v.Magnitude, 1e-14);
v = new Vector4F(0.0f, 0.0f, 3.0f, 4.0f);
Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
Assert.AreEqual(5.0f, v.Magnitude, 1e-14);
}
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:18,代码来源:Vector4FTests.cs
示例16: SetColor
public static void SetColor(this EffectParameter parameter, Vector4F color)
{
if (parameter.ColumnCount == 4)
{
parameter.SetValue((Vector4)color);
}
else
{
Vector3 value = new Vector3(color.X, color.Y, color.Z);
parameter.SetValue(value);
}
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:12,代码来源:EffectHelper.cs
示例17: Render
private void Render(RenderContext context, Vector4F color, Texture2D colorTexture, bool preserveColor)
{
if (context == null)
throw new ArgumentNullException("context");
context.Validate(_effect);
context.ThrowIfCameraMissing();
context.ThrowIfGBuffer0Missing();
var graphicsDevice = _effect.GraphicsDevice;
var savedRenderState = new RenderStateSnapshot(graphicsDevice);
graphicsDevice.DepthStencilState = GraphicsHelper.DepthStencilStateAlways;
graphicsDevice.RasterizerState = RasterizerState.CullNone;
if (preserveColor)
graphicsDevice.BlendState = GraphicsHelper.BlendStateNoColorWrite;
else
graphicsDevice.BlendState = BlendState.Opaque;
if (colorTexture != null)
{
if (TextureHelper.IsFloatingPointFormat(colorTexture.Format))
graphicsDevice.SamplerStates[1] = SamplerState.PointClamp;
else
graphicsDevice.SamplerStates[1] = SamplerState.LinearClamp;
}
var projection = context.CameraNode.Camera.Projection;
bool isPerspective = projection is PerspectiveProjection;
float near = projection.Near * NearBias;
float far = projection.Far * FarBias;
var biasedProjection = isPerspective
? Matrix44F.CreatePerspectiveOffCenter(
projection.Left, projection.Right,
projection.Bottom, projection.Top,
near, far)
: Matrix44F.CreateOrthographicOffCenter(
projection.Left, projection.Right,
projection.Bottom, projection.Top,
near, far);
var viewport = graphicsDevice.Viewport;
_parameterViewportSize.SetValue(new Vector2(viewport.Width, viewport.Height));
_parameterProjection.SetValue((Matrix)biasedProjection);
_parameterCameraFar.SetValue(projection.Far);
_parameterGBuffer0.SetValue(context.GBuffer0);
_parameterColor.SetValue((Vector4)color);
_parameterSourceTexture.SetValue(colorTexture);
_effect.CurrentTechnique = isPerspective ? _techniquePerspective : _techniqueOrthographic;
_effect.CurrentTechnique.Passes[(colorTexture == null) ? 0 : 1].Apply();
graphicsDevice.DrawFullScreenQuad();
graphicsDevice.ResetTextures();
savedRenderState.Restore();
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:58,代码来源:RebuildZBufferRenderer.cs
示例18: GetBounds
/// <summary>
/// Gets the bounds of the specified sphere relative to the viewport.
/// </summary>
/// <param name="cameraNode">The camera node.</param>
/// <param name="positionWorld">The sphere center in world space.</param>
/// <param name="radius">The sphere radius.</param>
/// <returns>
/// The bounds (left, top, right, bottom) where each entry is in the range [0, 1].
/// </returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="cameraNode"/> is <see langword="null"/>.
/// </exception>
internal static Vector4F GetBounds(CameraNode cameraNode, Vector3F positionWorld, float radius)
{
var camera = cameraNode.Camera;
var projection = camera.Projection;
float near = projection.Near;
float left = projection.Left;
float width = projection.Width;
float top = projection.Top;
float height = projection.Height;
Vector3F l = cameraNode.PoseWorld.ToLocalPosition(positionWorld);
float r = radius;
// Default bounds (left, top, right, bottom)
var bounds = new Vector4F(0, 0, 1, 1);
// ----- Solve for N = (x, 0, z).
// Discriminant already divided by 4:
float d = (r * r * l.X * l.X - (l.X * l.X + l.Z * l.Z) * (r * r - l.Z * l.Z));
if (d > 0)
{
// Camera is outside the sphere.
float rootD = (float)Math.Sqrt(d);
// Now check two possible solutions (+/- rootD):
float nx1 = (r * l.X + rootD) / (l.X * l.X + l.Z * l.Z);
float nx2 = (r * l.X - rootD) / (l.X * l.X + l.Z * l.Z);
float nz1 = (r - nx1 * l.X) / l.Z;
float nz2 = (r - nx2 * l.X) / l.Z;
// Compute tangent position (px, 0, pz) on the sphere.
float pz1 = (l.X * l.X + l.Z * l.Z - r * r) / (l.Z - (nz1 / nx1) * l.X);
float pz2 = (l.X * l.X + l.Z * l.Z - r * r) / (l.Z - (nz2 / nx2) * l.X);
if (pz1 < 0)
{
// Plane (nx1, 0, nz1) is within camera frustum.
float px = -pz1 * nz1 / nx1;
float x = nz1 * near / nx1; // x coordinate on the near plane.
float boundsX = (x - left) / width; // Value relative to viewport. (0 = left, 1 = right)
// Shrink the scissor rectangle on the left or on the right side.
if (px < l.X)
bounds.X = Math.Max(bounds.X, boundsX);
else
bounds.Z = Math.Min(bounds.Z, boundsX);
}
if (pz2 < 0)
{
float px = -pz2 * nz2 / nx2;
float x = nz2 * near / nx2;
float scissorX = (x - left) / width;
if (px < l.X)
bounds.X = Math.Max(bounds.X, scissorX);
else
bounds.Z = Math.Min(bounds.Z, scissorX);
}
}
// ----- Solve for N = (0, y, z) first.
d = (r * r * l.Y * l.Y - (l.Y * l.Y + l.Z * l.Z) * (r * r - l.Z * l.Z));
if (d > 0)
{
// Camera is outside the sphere.
float rootD = (float)Math.Sqrt(d);
float ny1 = (r * l.Y + rootD) / (l.Y * l.Y + l.Z * l.Z);
float ny2 = (r * l.Y - rootD) / (l.Y * l.Y + l.Z * l.Z);
float nz1 = (r - ny1 * l.Y) / l.Z;
float nz2 = (r - ny2 * l.Y) / l.Z;
float pz1 = (l.Y * l.Y + l.Z * l.Z - r * r) / (l.Z - (nz1 / ny1) * l.Y);
float pz2 = (l.Y * l.Y + l.Z * l.Z - r * r) / (l.Z - (nz2 / ny2) * l.Y);
if (pz1 < 0)
{
float py = -pz1 * nz1 / ny1;
//.........这里部分代码省略.........
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:101,代码来源:GraphicsHelper_Viewports.cs
示例19: OnProcess
protected override void OnProcess(RenderContext context)
{
context.ThrowIfCameraMissing();
context.ThrowIfGBuffer0Missing();
var graphicsDevice = GraphicsService.GraphicsDevice;
var renderTargetPool = GraphicsService.RenderTargetPool;
var source = context.SourceTexture;
var target = context.RenderTarget;
var viewport = context.Viewport;
// Get temporary render targets.
var sourceSize = new Vector2F(source.Width, source.Height);
var isFloatingPointFormat = TextureHelper.IsFloatingPointFormat(source.Format);
var sceneFormat = new RenderTargetFormat(source.Width, source.Height, false, source.Format, DepthFormat.None);
var maskedScene = renderTargetPool.Obtain2D(sceneFormat);
var rayFormat = new RenderTargetFormat(
Math.Max(1, (int)(sourceSize.X / DownsampleFactor)),
Math.Max(1, (int)(sourceSize.Y / DownsampleFactor)),
false,
source.Format,
DepthFormat.None);
var rayImage0 = renderTargetPool.Obtain2D(rayFormat);
var rayImage1 = renderTargetPool.Obtain2D(rayFormat);
// Get view and view-projection transforms.
var cameraNode = context.CameraNode;
Matrix44F projection = cameraNode.Camera.Projection.ToMatrix44F();
Matrix44F view = cameraNode.View;
Matrix44F viewProjection = projection * view;
// We simply place the light source "far away" in opposite light ray direction.
Vector4F lightPositionWorld = new Vector4F(-LightDirection * 10000, 1);
// Convert to clip space.
Vector4F lightPositionProj = viewProjection * lightPositionWorld;
Vector3F lightPositionClip = Vector4F.HomogeneousDivide(lightPositionProj);
// Convert from clip space [-1, 1] to texture space [0, 1].
Vector2 lightPosition = new Vector2(lightPositionClip.X * 0.5f + 0.5f, -lightPositionClip.Y * 0.5f + 0.5f);
// We use dot²(forward, -LightDirection) as a smooth S-shaped attenuation
// curve to reduce the god ray effect when we look orthogonal or away from the sun.
var lightDirectionView = view.TransformDirection(LightDirection);
float z = Math.Max(0, lightDirectionView.Z);
float attenuation = z * z;
// Common effect parameters.
_parameters0Parameter.SetValue(new Vector4(lightPosition.X, lightPosition.Y, LightRadius * LightRadius, Scale));
_parameters1Parameter.SetValue(new Vector2(Softness, graphicsDevice.Viewport.AspectRatio));
_intensityParameter.SetValue((Vector3)Intensity * attenuation);
_numberOfSamplesParameter.SetValue(NumberOfSamples);
_gBuffer0Parameter.SetValue(context.GBuffer0);
// First, create a scene image where occluders are black.
graphicsDevice.SetRenderTarget(maskedScene);
_viewportSizeParameter.SetValue(new Vector2(graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height));
_sourceTextureParameter.SetValue(source);
graphicsDevice.SamplerStates[0] = isFloatingPointFormat ? SamplerState.PointClamp : SamplerState.LinearClamp;
graphicsDevice.SamplerStates[1] = SamplerState.PointClamp; // G-Buffer 0.
_createMaskPass.Apply();
graphicsDevice.DrawFullScreenQuad();
// Downsample image.
context.SourceTexture = maskedScene;
context.RenderTarget = rayImage0;
context.Viewport = new Viewport(0, 0, rayImage0.Width, rayImage0.Height);
_downsampleFilter.Process(context);
// Compute light shafts.
_viewportSizeParameter.SetValue(new Vector2(context.Viewport.Width, context.Viewport.Height));
graphicsDevice.SamplerStates[0] = isFloatingPointFormat ? SamplerState.PointClamp : SamplerState.LinearClamp;
for (int i = 0; i < NumberOfPasses; i++)
{
graphicsDevice.SetRenderTarget(rayImage1);
_sourceTextureParameter.SetValue(rayImage0);
_blurPass.Apply();
graphicsDevice.DrawFullScreenQuad();
// Put the current result in variable rayImage0.
MathHelper.Swap(ref rayImage0, ref rayImage1);
}
// Combine light shaft image with scene.
graphicsDevice.SetRenderTarget(target);
graphicsDevice.Viewport = viewport;
_viewportSizeParameter.SetValue(new Vector2(graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height));
_sourceTextureParameter.SetValue(source);
_rayTextureParameter.SetValue(rayImage0);
graphicsDevice.SamplerStates[0] = isFloatingPointFormat ? SamplerState.PointClamp : SamplerState.LinearClamp;
graphicsDevice.SamplerStates[1] = isFloatingPointFormat ? SamplerState.PointClamp : SamplerState.LinearClamp;
_combinePass.Apply();
graphicsDevice.DrawFullScreenQuad();
// Clean-up
_sourceTextureParameter.SetValue((Texture2D)null);
_gBuffer0Parameter.SetValue((Texture2D)null);
//.........这里部分代码省略.........
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:101,代码来源:GodRayFilter.cs
示例20: RenderFlag
private void RenderFlag(float t, double a, int shells)
{
TechniqueDescription techDesc = effects.Technique.Description;
for (int x = -shells; x <= shells; x++)
{
for (int z = -shells; z <= shells; z++)
{
float height = ((float)Math.Sin(0.5 * (x + 4 * t)) + (float)Math.Cos(0.25 * (z + 2 * t)));
Vector4F vBaseColor = new Vector4F( 0.0f, 0.0f, 0.0f, 1.0f );
if (x < 0 && z > 0)
vBaseColor.X = 0.75f + 0.125f * height; //red
else if (x > 0 && z > 0)
vBaseColor.Y = 0.75f + 0.125f * height; //green
else if (x < 0 && z < 0)
vBaseColor.Z = 0.75f + 0.125f * height; //blue
else if (x > 0 && z < 0)
{//yellow
vBaseColor.X= 0.75f + 0.125f * height;
vBaseColor.Y = 0.75f + 0.125f * height;
}
else
continue;
effects.BaseColor = vBaseColor;
float yScale = 5f + 0.5f * height;
effects.WorldMatrix =
MatrixMath.MatrixScale(0.35f, yScale, 0.35f) *
MatrixMath.MatrixTranslate(x, yScale - 10 , z);
for (uint p = 0; p < techDesc.Passes; ++p)
{
effects.Technique.GetPassByIndex(p).Apply();
device.DrawIndexed(36, 0, 0);
}
}
}
}
开发者ID:Prashant-Jonny,项目名称:phever,代码行数:37,代码来源:Window.cs
注:本文中的Vector4F类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论