本文整理汇总了C#中Vector4类的典型用法代码示例。如果您正苦于以下问题:C# Vector4类的具体用法?C# Vector4怎么用?C# Vector4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector4类属于命名空间,在下文中一共展示了Vector4类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]);
}
开发者ID:FreeReign,项目名称:UltimaXNA,代码行数:35,代码来源:YSpriteBatch_DrawString.cs
示例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();
}
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:39,代码来源:DynamoPointGeometryModel3D.cs
示例3: Vertex
public Vertex(Vector4 position, Color4 color, Vector2 textureCoordinate, uint faceIndex)
{
Position = position;
Color = color;
TextureCoordinate = textureCoordinate;
FaceIndex = faceIndex;
}
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:7,代码来源:Program.cs
示例4: VertexVoxel
public VertexVoxel(Vector3 pos, Vector2 uv, Vector4 uvr, Color c)
{
Position = pos;
UV = uv;
UVRect = uvr;
Tint = c;
}
开发者ID:RegrowthStudios,项目名称:VoxelRTS,代码行数:7,代码来源:VertexVoxel.cs
示例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;
}
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:8,代码来源:VectorUtil.cs
示例6: VertexPositionNormal4Texture
public VertexPositionNormal4Texture(Vector3 position, Vector3 normal, Vector4 textureWeight, Vector4 textureType)
{
Position = position;
Normal = normal;
TextureWeight = textureWeight;
TextureType = textureType;
}
开发者ID:Jupotter,项目名称:Nameless-Tales,代码行数:7,代码来源:Ground.cs
示例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);
}
开发者ID:HaKDMoDz,项目名称:Irelia,代码行数:7,代码来源:Vector4Test.cs
示例8: HslColor
public HslColor(Vector4 v4)
{
H = v4.X;
S = v4.Y;
L = v4.Z;
A = v4.W;
}
开发者ID:CodetopiaLLC,项目名称:ExamplesXNA4x,代码行数:7,代码来源:HslColor.cs
示例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
};
}
开发者ID:mclark4386,项目名称:SaintCoinach,代码行数:30,代码来源:BoundingBox.cs
示例10: Vector4
public Vector4(Vector4 vector)
{
PointsArray = new double[4];
X = vector.X;
Y = vector.Y;
Z = vector.Z;
}
开发者ID:Arkady92,项目名称:VR,代码行数:7,代码来源:Vector4.cs
示例11: Init
public void Init( Vector4 av4Input )
{
maxXAndY.x = av4Input.z;
maxXAndY.y = av4Input.w;
minXAndY.x = av4Input.x;
minXAndY.y = av4Input.y;
}
开发者ID:patrick-ryan-aie,项目名称:TrickyNinja,代码行数:7,代码来源:CameraFollow.cs
示例12: GrassV2zone
public GrassV2zone(List<MaskPixRGB> pixels, Vector4 bounds, int tex = -1)
{
m_pixels = pixels;
m_bounds = bounds;
m_textureID = tex;
m_texGen = null;
}
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:7,代码来源:IEv2_Zone.cs
示例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);
}
开发者ID:PersonalityPi,项目名称:HaloOnlineTagTool,代码行数:12,代码来源:VertexCompressor.cs
示例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);
}
开发者ID:PersonalityPi,项目名称:HaloOnlineTagTool,代码行数:12,代码来源:VertexCompressor.cs
示例15: BasicVec4
public BasicVec4(Vector4 v)
{
x = v.X;
y = v.Y;
z = v.Z;
w = v.W;
}
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:7,代码来源:ModelViewer.cs
示例16: Start
public override void Start()
{
isStarted = true;
if (duration == 0)
{
sprite.SetOverlay(this.toColor);
if (!isInfinite) this.Stop();
return;
}
this.originalColor = sprite.GetOverlay();
if (isFromNull) this.fromColor = this.originalColor;
// velocity = UtilityHelper.CalculateVelocity(this.fromColor, this.toColor, duration);
Sign = UtilityHelper.CalculateSign(this.fromColor, this.toColor);
currentColor = this.fromColor;
if (isAnimatedFromOrigin)
{
currentColor = this.originalColor;
Sign = UtilityHelper.CalculateSign(currentColor, this.fromColor);
}
else
{
sprite.SetOverlay(this.currentColor);
}
CurrentTime = TimeSpan.Zero;
Duration = TimeSpan.FromSeconds(duration);
totalDistance = UtilityHelper.VectorAbs(Vector4.Subtract(toColor, fromColor));
if (graphFunction == null)
graphFunction = new ConstantGraphFunction(duration);
}
开发者ID:bikrone,项目名称:hexagon,代码行数:35,代码来源:ColorAnimation.cs
示例17: smokeyCalc
public static Vector4 smokeyCalc(Vector4 a, Vector4 b, double t)
{
return new Vector4(smokeyCalc(a.X, b.X, t),
smokeyCalc(a.Y, b.Y, t),
smokeyCalc(a.Z, b.Z, t),
smokeyCalc(a.W, b.W, t));
}
开发者ID:ms223uh,项目名称:1DV437,代码行数:7,代码来源:SmokeCalculate.cs
示例18: MyGuiControlCheckbox
public MyGuiControlCheckbox(IMyGuiControlsParent parent, Vector2 position, Vector2 size, MyTexture2D texture, MyTexture2D checkedTexture,
StringBuilder toolTip, bool checkedVal, Vector4 color, bool highlightWhenChecked, MyGuiControlLabel label, Vector2? innerSize = null)
: base(parent, position, size, color, toolTip, texture, null, null, true)
{
m_canHandleKeyboardActiveControl = true;
m_checked = checkedVal;
m_highlightWhenChecked = false; // highlightWhenChecked; this feature is depracted
m_checkedTexture = checkedTexture;
m_label = label;
if (m_label != null) {
m_label.MouseEnter += delegate
{
m_highlight = true;
};
m_label.MouseLeave += delegate
{
m_highlight = false;
};
m_label.Click += delegate
{
UserCheck();
};
}
if (innerSize == null) m_innerSize = size;
else m_innerSize = innerSize;
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:26,代码来源:MyGuiControlCheckbox.cs
示例19: Raymarch
void Raymarch(int width, int height, Vector4 lightPos)
{
SetFrustumRays(m_RaymarchMaterial);
int shadowmapWidth = m_Shadowmap.width;
int shadowmapHeight = m_Shadowmap.height;
Graphics.SetRenderTarget(m_RaymarchedLightEpi.colorBuffer, m_RaymarchedLightEpi.depthBuffer);
GL.Clear(false, true, new Color(0, 0, 0, 1));
m_RaymarchMaterial.SetTexture("_Coord", m_CoordEpi);
m_RaymarchMaterial.SetTexture("_InterpolationEpi", m_InterpolationEpi);
m_RaymarchMaterial.SetTexture("_Shadowmap", m_Shadowmap);
float brightness = m_Colored ? m_BrightnessColored/m_ColorBalance : m_Brightness;
brightness *= m_Light.intensity;
m_RaymarchMaterial.SetFloat("_Brightness", brightness);
m_RaymarchMaterial.SetFloat("_Extinction", -m_Extinction);
m_RaymarchMaterial.SetVector("_ShadowmapDim", new Vector4(shadowmapWidth, shadowmapHeight, 1.0f / shadowmapWidth, 1.0f / shadowmapHeight));
m_RaymarchMaterial.SetVector("_ScreenTexDim", new Vector4(width, height, 1.0f / width, 1.0f / height));
m_RaymarchMaterial.SetVector("_LightColor", m_Light.color.linear);
m_RaymarchMaterial.SetFloat("_MinDistFromCamera", m_MinDistFromCamera);
SetKeyword(m_Colored, "COLORED_ON", "COLORED_OFF");
m_RaymarchMaterial.SetTexture("_ColorFilter", m_ColorFilter);
SetKeyword(m_AttenuationCurveOn, "ATTENUATION_CURVE_ON", "ATTENUATION_CURVE_OFF");
m_RaymarchMaterial.SetTexture("_AttenuationCurveTex", m_AttenuationCurveTex);
Texture cookie = m_Light.cookie;
SetKeyword(cookie != null, "COOKIE_TEX_ON", "COOKIE_TEX_OFF");
if (cookie != null)
m_RaymarchMaterial.SetTexture("_Cookie", cookie);
m_RaymarchMaterial.SetPass(0);
RenderQuadSections(lightPos);
}
开发者ID:robertcupisz,项目名称:LightShafts,代码行数:32,代码来源:LightShafts.cs
示例20: In
public void In(
[FriendlyName("A", "The Vector4 to subtract from. If more than one Vector4 variable is connected to A, they will be subtracted from (0, 0, 0, 0) before B is subtracted from them.")]
Vector4[] A,
[FriendlyName("B", "The Vector4 to subtract from A. If more than one Vector4 variable is connected to B, they will be subtracted from (0, 0, 0, 0) before being subtracted from A.")]
Vector4[] B,
[FriendlyName("Result", "The Vector4 result of the subtraction operation.")]
out Vector4 Result
)
{
Vector4 aTotals = new Vector4(0, 0, 0, 0);
Vector4 bTotals = new Vector4(0, 0, 0, 0);
foreach (Vector4 currentA in A)
{
aTotals = aTotals - currentA;
}
foreach (Vector4 currentB in B)
{
bTotals = bTotals - currentB;
}
Result = aTotals - bTotals;
}
开发者ID:remistorms,项目名称:PassTheBeer,代码行数:25,代码来源:uScriptAct_SubtractVector4.cs
注:本文中的Vector4类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论