本文整理汇总了C#中Vector4类的典型用法代码示例。如果您正苦于以下问题:C# Vector4类的具体用法?C# Vector4怎么用?C# Vector4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector4类属于命名空间,在下文中一共展示了Vector4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawSpriteGlyph
internal void DrawSpriteGlyph(Texture2D texture, Vector4 dest, Vector4 source, Color color)
{
if (!m_DrawString_InProgress)
Logging.Fatal("BeginDrawString() must be called before DrawSpriteGlyph()");
Vector4 uv = new Vector4(
(float)source.X / texture.Width,
(float)source.Y / texture.Height,
(float)(source.X + source.Z) / texture.Width,
(float)(source.Y + source.W) / texture.Height);
VertexPositionTextureHueExtra[] v = new VertexPositionTextureHueExtra[4]
{
new VertexPositionTextureHueExtra(new Vector3(dest.X, dest.Y, m_DrawString_Depth), new Vector2(uv.X, uv.Y), color, Vector4.Zero), // top left
new VertexPositionTextureHueExtra(new Vector3(dest.X + dest.Z, dest.Y, m_DrawString_Depth), new Vector2(uv.Z, uv.Y), color, Vector4.Zero), // top right
new VertexPositionTextureHueExtra(new Vector3(dest.X, dest.Y + dest.W, m_DrawString_Depth), new Vector2(uv.X, uv.W), color, Vector4.Zero), // bottom left
new VertexPositionTextureHueExtra(new Vector3(dest.X + dest.Z, dest.Y + dest.W, m_DrawString_Depth), new Vector2(uv.Z, uv.W), color, Vector4.Zero) // bottom right
};
/*if (shadow != null)
{
Color shadow2 = new Color(
shadow.Value.R, shadow.Value.G,
shadow.Value.B, 128);
for (int i = 0; i < 4; i++)
{
VertexPositionTextureHueExtra v0 = v[i];
v0.Hue = shadow.Value;
v0.Position.Y += 1f;
m_DrawString_VertexList.Add(v0);
}
}*/
for (int i = 0; i < 4; i++)
m_DrawString_VertexList.Add(v[i]);
}
示例2: Attach
/// <summary>
/// Override PointGeometryModel3D's Attach method to
/// provide a buffer of DynamoPointVertices
/// </summary>
public override void Attach(IRenderHost host)
{
var techManager = host.RenderTechniquesManager;
renderTechnique = techManager.RenderTechniques[DefaultRenderTechniqueNames.Points];
base.Attach(host);
if (Geometry == null)
return;
if (renderHost.RenderTechnique == host.RenderTechniquesManager.RenderTechniques.Get(DeferredRenderTechniqueNames.Deferred) ||
renderHost.RenderTechnique == host.RenderTechniquesManager.RenderTechniques.Get(DeferredRenderTechniqueNames.Deferred))
return;
vertexLayout = host.EffectsManager.GetLayout(renderTechnique);
effectTechnique = effect.GetTechniqueByName(renderTechnique.Name);
effectTransforms = new EffectTransformVariables(effect);
var geometry = Geometry as PointGeometry3D;
if (geometry != null)
{
vertexBuffer = Device.CreateBuffer(BindFlags.VertexBuffer, VertexSizeInBytes, CreateVertexArray());
}
vViewport = effect.GetVariableByName("vViewport").AsVector();
vPointParams = effect.GetVariableByName("vPointParams").AsVector();
var pointParams = new Vector4((float)Size.Width, (float)Size.Height, (float)Figure, (float)FigureRatio);
vPointParams.Set(pointParams);
OnRasterStateChanged(DepthBias);
Device.ImmediateContext.Flush();
}
示例3: Vertex
public Vertex(Vector4 position, Color4 color, Vector2 textureCoordinate, uint faceIndex)
{
Position = position;
Color = color;
TextureCoordinate = textureCoordinate;
FaceIndex = faceIndex;
}
示例4: VertexVoxel
public VertexVoxel(Vector3 pos, Vector2 uv, Vector4 uvr, Color c)
{
Position = pos;
UV = uv;
UVRect = uvr;
Tint = c;
}
示例5: Mult
/// 行列との掛け算
public static Vector4 Mult( ref Vector4 pos, Matrix4 mtx )
{
calPos4.X = (mtx.M11 * pos.X) + (mtx.M21 * pos.Y) + ( mtx.M31 * pos.Z ) + ( mtx.M41 * pos.W );
calPos4.Y = (mtx.M12 * pos.X) + (mtx.M22 * pos.Y) + ( mtx.M32 * pos.Z ) + ( mtx.M42 * pos.W );
calPos4.Z = (mtx.M13 * pos.X) + (mtx.M23 * pos.Y) + ( mtx.M33 * pos.Z ) + ( mtx.M43 * pos.W );
return calPos4;
}
示例6: VertexPositionNormal4Texture
public VertexPositionNormal4Texture(Vector3 position, Vector3 normal, Vector4 textureWeight, Vector4 textureType)
{
Position = position;
Normal = normal;
TextureWeight = textureWeight;
TextureType = textureType;
}
示例7: Vector4_ConstructFromVector3Test
public void Vector4_ConstructFromVector3Test()
{
Vector3 v3 = new Vector3(1.0f, 2.0f, 3.0f);
Vector4 v4 = new Vector4(v3, 0.8f);
Vector4 expected = new Vector4(v3.x, v3.y, v3.z, 0.8f);
Assert.AreEqual(expected, v4);
}
示例8: HslColor
public HslColor(Vector4 v4)
{
H = v4.X;
S = v4.Y;
L = v4.Z;
A = v4.W;
}
示例9: Grow
public BoundingBox Grow(Vector3 change) {
var center = new Vector3 {
X = (PointA.X + PointB.X) / 2f,
Y = (PointA.Y + PointB.Y) / 2f,
Z = (PointA.Z + PointB.Z) / 2f
};
var d = new Vector3 {
X = Math.Abs(PointA.X - center.X) + change.X,
Y = Math.Abs(PointA.Y - center.Y) + change.Y,
Z = Math.Abs(PointA.Z - center.Z) + change.Z
};
var retPointA = new Vector4 {
X = center.X + d.X,
Y = center.Y + d.Y,
Z = center.Z + d.Z,
W = PointA.W
};
var retPointB = new Vector4 {
X = center.X - d.X,
Y = center.Y - d.Y,
Z = center.Z - d.Z,
W = PointB.W
};
return new BoundingBox {
PointA = retPointA,
PointB = retPointB
};
}
示例10: Vector4
public Vector4(Vector4 vector)
{
PointsArray = new double[4];
X = vector.X;
Y = vector.Y;
Z = vector.Z;
}
示例11: Init
public void Init( Vector4 av4Input )
{
maxXAndY.x = av4Input.z;
maxXAndY.y = av4Input.w;
minXAndY.x = av4Input.x;
minXAndY.y = av4Input.y;
}
示例12: GrassV2zone
public GrassV2zone(List<MaskPixRGB> pixels, Vector4 bounds, int tex = -1)
{
m_pixels = pixels;
m_bounds = bounds;
m_textureID = tex;
m_texGen = null;
}
示例13: DecompressPosition
/// <summary>
/// Decompresses a position so that its components are in model space.
/// </summary>
/// <param name="pos">The position to decompress.</param>
/// <returns>The decompressed position.</returns>
public Vector4 DecompressPosition(Vector4 pos)
{
var newX = pos.X * _xScale + _info.PositionMinX;
var newY = pos.Y * _yScale + _info.PositionMinY;
var newZ = pos.Z * _zScale + _info.PositionMinZ;
return new Vector4(newX, newY, newZ, pos.W);
}
示例14: CompressPosition
/// <summary>
/// Compresses a position so that its components are between 0 and 1.
/// </summary>
/// <param name="pos">The position to compress.</param>
/// <returns>The compressed position.</returns>
public Vector4 CompressPosition(Vector4 pos)
{
var newX = (pos.X - _info.PositionMinX) / _xScale;
var newY = (pos.Y - _info.PositionMinY) / _yScale;
var newZ = (pos.Z - _info.PositionMinZ) / _zScale;
return new Vector4(newX, newY, newZ, pos.W);
}
示例15: BasicVec4
public BasicVec4(Vector4 v)
{
x = v.X;
y = v.Y;
z = v.Z;
w = v.W;
}