本文整理汇总了C#中OpenTK.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# Vector3类的具体用法?C# Vector3怎么用?C# Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3类属于OpenTK命名空间,在下文中一共展示了Vector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Builder
internal Builder()
{
_position = Vector3.Zero;
_color = 0;
_textureUV = Vector2.Zero;
_normal = Vector3.Zero;
}
示例2: OutputParticle
/// <summary>
/// 粒子を作成する
/// </summary>
/// <param name="_x">中心座標</param>
/// <param name="_d">直径</param>
/// <param name="_color">表示色</param>
public OutputParticle(Vector3 _x, float _d, Color4 _color)
{
// 各パラメーターを設定
this.X = _x;
this.d = _d;
this.color = _color;
}
示例3: CreateCubeMesh
public IEnumerable<Face> CreateCubeMesh()
{
//Front
var vertex0 = new Vector3(-0.5f, -0.5f, 0.5f);
var vertex1 = new Vector3(-0.5f, 0.5f, 0.5f);
var vertex2 = new Vector3(0.5f, 0.5f, 0.5f);
var vertex3 = new Vector3(0.5f, -0.5f, 0.5f);
//Rear
var vertex4 = new Vector3(-0.5f, -0.5f, -0.5f);
var vertex5 = new Vector3(-0.5f, 0.5f, -0.5f);
var vertex6 = new Vector3(0.5f, 0.5f, -0.5f);
var vertex7 = new Vector3(0.5f, -0.5f, -0.5f);
var front = new Face(new List<Vector3> { vertex0, vertex1, vertex2, vertex3 });
var back = new Face(new List<Vector3> { vertex4, vertex5, vertex6, vertex7 });
var left = new Face(new List<Vector3> { vertex4, vertex5, vertex1, vertex0 });
var right = new Face(new List<Vector3> { vertex7, vertex3, vertex2, vertex6 });
var top = new Face(new List<Vector3> { vertex1, vertex5, vertex6, vertex2 });
var bottom = new Face(new List<Vector3> { vertex0, vertex4, vertex7, vertex3 });
return new List<Face> {front, back, left, right, top, bottom};
}
示例4: Body
public Body(Vector3 location, float mass)
{
Acceleration = Vector3.Zero;
Location = location;
Mass = mass;
Velocity = Vector3.Zero;
}
示例5: GetOrientationMatrix
/// <summary>
/// Returns a rotation matrix with position <0,0,0> according to vector x and z
/// </summary>
/// <param name="x"> the x vector</param>
/// <param name="z">the z vector</param>
/// <returns>Rotation matrix</returns>
public static Matrix4 GetOrientationMatrix(Vector3 x, Vector3 z)
{
x.NormalizeFast();
z.NormalizeFast();
Vector3 y = Vector3.Cross(z, x);
return GetMatrix(Vector3.Zero, z, y, Vector3.Cross(y, z));
}
示例6: Ray
public Ray(Vector3 position, Vector3 direction, float minT, float maxT)
{
Origin = position;
Direction = direction;
this.tMin = minT;
this.tMax = maxT;
}
示例7: BuildingVertex
#pragma warning restore 414
public BuildingVertex(Vector3 position, Vector3 normal, Vector2 uv, float alpha = 1)
{
this.position = position;
this.normal = normal;
this.uv = uv;
this.alpha = alpha;
}
示例8: TransformationManager
public TransformationManager(Vector3 pos, Quaternion orient)
{
Position = pos;
Orientation = orient;
ScaleValue = new Vector3(1, 1, 1);
BeenModified = true;
}
示例9: CreateCube
private void CreateCube(float x, float y, float z, float sizeX, float sizeY, float sizeZ)
{
//Top vertexes
var point1Bottom = new Vector3(x, z, y);
var point2Bottom = new Vector3(x + sizeX, z, y);
var point3Bottom = new Vector3(x + sizeX, z, y + sizeY);
var point4Bottom = new Vector3(x, z, y + sizeY);
//Bottom vertexes
var point1Top = new Vector3(x, z + sizeZ, y);
var point2Top = new Vector3(x + sizeX, z + sizeZ, y);
var point3Top = new Vector3(x + sizeX, z + sizeZ, y + sizeY);
var point4Top = new Vector3(x, z + sizeZ, y + sizeY);
//Normals
var topNormal = new Vector3(0, 1, 0);
var bottomNormal = new Vector3(0, -1, 0);
var leftNormal = new Vector3(-1, 0, 0);
var rightNormal = new Vector3(1, 0, 0);
var farNormal = new Vector3(0, 0, -1);
var nearNormal = new Vector3(0, 0, 1);
CreateCubeFace(point4Top, point1Top, point2Top, point3Top, topNormal);
CreateCubeFace(point1Bottom, point4Bottom, point3Bottom, point2Bottom, bottomNormal);
CreateCubeFace(point1Top, point1Bottom, point2Bottom, point2Top, farNormal);
CreateCubeFace(point3Top, point3Bottom, point4Bottom, point4Top, nearNormal);
CreateCubeFace(point4Top, point4Bottom, point1Bottom, point1Top, leftNormal);
CreateCubeFace(point2Top, point2Bottom, point3Bottom, point3Top, rightNormal);
}
示例10: ProcessVertex
public void ProcessVertex(string line, Mesh mesh)
{
if (!mesh.SubMeshes.Any())
mesh.SubMeshes.Add(new SubMesh());
var tokens = line.Split(' ');
if (tokens.Length != 4) return;
Vector3 vertex = new Vector3
{
X = float.Parse(tokens[1], Style, Info),
Y = float.Parse(tokens[2], Style, Info),
Z = float.Parse(tokens[3], Style, Info)
};
mesh.SubMeshes.Last().Vertices.Add(vertex);
// Bounds
if (vertex.X < mesh.MinVertex.X) mesh.MinVertex.X = vertex.X;
if (vertex.Y < mesh.MinVertex.Y) mesh.MinVertex.Y = vertex.Y;
if (vertex.Z < mesh.MinVertex.Z) mesh.MinVertex.Z = vertex.Z;
if (vertex.X > mesh.MaxVertex.X) mesh.MaxVertex.X = vertex.X;
if (vertex.Y > mesh.MaxVertex.Y) mesh.MaxVertex.Y = vertex.Y;
if (vertex.Z > mesh.MaxVertex.Z) mesh.MaxVertex.Z = vertex.Z;
}
示例11: Material
//The material constructor, takes a color Vector, a diffuse value, reflection value and a recursionDepth.
public Material(Vector3 color, float diffuse, float reflection, float recursionDepth)
{
this.color = color;
this.diffuse = diffuse;
this.reflection = reflection;
this.recursionDepth = recursionDepth;
}
示例12: Spotlight
//Spotlight constructor, takes a position Vector, a color Vector, a direction Vector and
public Spotlight(Vector3 position, Vector3 color, Vector3 direction, float minDot)
{
pos = position;
this.color = color;
D = direction.Normalized();
this.minDot = minDot;
}
示例13: SimpleSpriteVertexData
/// <summary>
/// Initializes a new instance of the <see cref="SimpleSpriteVertexData"/> struct.
/// </summary>
/// <param name="position">The position.</param>
/// <param name="uv">The uv coordinates.</param>
/// <param name="color">The color.</param>
/// <param name="expand">The vector by which to move the vertex in camera space, parallel to the view plane.</param>
public SimpleSpriteVertexData(Vector3 position, Vector2 uv, Color color, Vector2 expand)
{
this.Position = position;
this.TexCoord = uv;
this.Color = color;
this.Expand = expand;
}
示例14: CheckSphere
public bool CheckSphere(Vector3 boundingSphereCenter, float boundingSphereR)
{
if (!this.Front.CheckSphere(ref boundingSphereCenter, ref boundingSphereR))
{
return false;
}
if (!this.Back.CheckSphere(ref boundingSphereCenter, ref boundingSphereR))
{
return false;
}
if (!this.Right.CheckSphere(ref boundingSphereCenter, ref boundingSphereR))
{
return false;
}
if (!this.Right2.CheckSphere(ref boundingSphereCenter, ref boundingSphereR))
{
return false;
}
if (!this.Right3.CheckSphere(ref boundingSphereCenter, ref boundingSphereR))
{
return false;
}
if (!this.Right4.CheckSphere(ref boundingSphereCenter, ref boundingSphereR))
{
return false;
}
return true;
}
示例15: Vertex2D
/// <summary>
/// Initializes a new instance of the <see cref="nginz.Vertex2D"/> struct.
/// </summary>
/// <param name="pos">Position.</param>
/// <param name="texcoord">Texcoord.</param>
/// <param name="color">Color.</param>
public Vertex2D(Vector3 pos, Vector2 texcoord, Color4 color)
: this()
{
Position = pos;
TextureCoordinate = texcoord;
Color = color;
}