本文整理汇总了C#中Vector3F类的典型用法代码示例。如果您正苦于以下问题:C# Vector3F类的具体用法?C# Vector3F怎么用?C# Vector3F使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3F类属于命名空间,在下文中一共展示了Vector3F类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SceneWithStaticMeshLODandVisObj
public void SceneWithStaticMeshLODandVisObj()
{
TestManager.Helpers.OpenSceneFromFile(TestManager.Helpers.TestDataDir + @"\VisibilityTests\VisibilityObjLinking.scene");
TestManager.Helpers.ProcessEvents();
// Start the simulation
EditorManager.EditorMode = EditorManager.Mode.EM_ANIMATING; // update view
TestManager.Helpers.ProcessEvents();
// Let the simulation run for some seconds
DateTime timeBefore = DateTime.Now;
EditorManager.ActiveView.SetCameraRotation(new Vector3F(90, 0, 0));
while (true)
{
TimeSpan passedTime = DateTime.Now - timeBefore;
if (passedTime.TotalSeconds > 5)
break;
Vector3F pos = new Vector3F(50.0f,(float)passedTime.TotalSeconds * -150.0f-150.0f, 120.0f);
EditorManager.ActiveView.SetCameraPosition(pos);
TestManager.Helpers.ProcessEvents();
}
// Stop simulation, set back
EditorManager.EditorMode = EditorManager.Mode.EM_NONE;
TextToWrite = null;
TestManager.Helpers.CloseActiveProject();
}
开发者ID:bgarrels,项目名称:projectanarchy,代码行数:29,代码来源:VisibilityTest.cs
示例2: MatrixLookAtLH
public static Matrix4x4F MatrixLookAtLH(Vector3F eye, Vector3F at, Vector3F up)
{
Vector3F right, vec;
vec = at - eye;
vec.NormalizeInPlace();
right = Vector3F.Cross(up, vec);
up = Vector3F.Cross(vec, right);
right.NormalizeInPlace();
up.NormalizeInPlace();
return new Matrix4x4F(
right.X,
up.X,
vec.X,
0.0f,
right.Y,
up.Y,
vec.Y,
0.0f,
right.Z,
up.Z,
vec.Z,
0.0f,
-Vector3F.Dot(right, eye),
-Vector3F.Dot(up, eye),
-Vector3F.Dot(vec, eye),
1.0f
);
}
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:32,代码来源:Camera.cs
示例3: AdditionOperator
public void AdditionOperator()
{
Vector3F a = new Vector3F(1.0f, 2.0f, 3.0f);
Vector3F b = new Vector3F(2.0f, 3.0f, 4.0f);
Vector3F c = a + b;
Assert.AreEqual(new Vector3F(3.0f, 5.0f, 7.0f), c);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:Vector3FTest.cs
示例4: Construct01
public void Construct01()
{
Vector3F v = new Vector3F(new Vector2F(1.0f, 2.0f), 3.0f);
Assert.AreEqual(1.0f, v.X);
Assert.AreEqual(2.0f, v.Y);
Assert.AreEqual(3.0f, v.Z);
}
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:7,代码来源:Vector3FTests.cs
示例5: SkyboxNode
/// <summary>
/// Initializes a new instance of the <see cref="SkyboxNode" /> class.
/// </summary>
/// <param name="texture">The cube map texture (using premultiplied alpha).</param>
public SkyboxNode(TextureCube texture)
{
Texture = texture;
Color = new Vector3F(1, 1, 1);
Alpha = 1.0f;
Encoding = ColorEncoding.SRgb;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:11,代码来源:SkyboxNode.cs
示例6: PlanarReflectionNode
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="PlanarReflectionNode" /> class.
/// </summary>
/// <param name="renderToTexture">The render texture target.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="renderToTexture"/> is <see langword="null"/>.
/// </exception>
public PlanarReflectionNode(RenderToTexture renderToTexture)
: base(renderToTexture)
{
CameraNode = new CameraNode(new Camera(new PerspectiveProjection()));
FieldOfViewScale = 1;
_normalLocal = new Vector3F(0, 0, 1);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:15,代码来源:PlanarReflectionNode.cs
示例7: Update
public override void Update(GameTime gameTime)
{
float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
// ----- Move target if <NumPad4-9> are pressed.
Vector3F translation = new Vector3F();
if (InputService.IsDown(Keys.NumPad4))
translation.X -= 1;
if (InputService.IsDown(Keys.NumPad6))
translation.X += 1;
if (InputService.IsDown(Keys.NumPad8))
translation.Y += 1;
if (InputService.IsDown(Keys.NumPad5))
translation.Y -= 1;
if (InputService.IsDown(Keys.NumPad9))
translation.Z += 1;
if (InputService.IsDown(Keys.NumPad7))
translation.Z -= 1;
translation = translation * deltaTime;
_targetPosition += translation;
// Convert target world space position to model space. - The IK solvers work in model space.
Vector3F localTargetPosition = _pose.ToLocalPosition(_targetPosition);
// Reset the affected bones. This is optional. It removes unwanted twist from the bones.
_skeletonPose.ResetBoneTransforms(_ikSolver.RootBoneIndex, _ikSolver.TipBoneIndex);
// Let IK solver update the bones.
_ikSolver.Target = localTargetPosition;
_ikSolver.Solve(deltaTime);
base.Update(gameTime);
}
开发者ID:HATtrick-games,项目名称:ICT309,代码行数:34,代码来源:ClosedFormIKSample.cs
示例8: DiagonalizeInertia
/// <summary>
/// Diagonalizes the inertia matrix.
/// </summary>
/// <param name="inertia">The inertia matrix.</param>
/// <param name="inertiaDiagonal">The inertia of the principal axes.</param>
/// <param name="rotation">
/// The rotation that rotates from principal axis space to parent/world space.
/// </param>
/// <remarks>
/// All valid inertia matrices can be transformed into a coordinate space where all elements
/// non-diagonal matrix elements are 0. The axis of this special space are the principal axes.
/// </remarks>
internal static void DiagonalizeInertia(Matrix33F inertia, out Vector3F inertiaDiagonal, out Matrix33F rotation)
{
// Alternatively we could use Jacobi transformation (iterative method, see Bullet/btMatrix3x3.diagonalize()
// and Numerical Recipes book) or we could find the eigenvalues using the characteristic
// polynomial which is a cubic polynomial and then solve for the eigenvectors (see Numeric
// Recipes and "Mathematics for 3D Game Programming and Computer Graphics" chapter ray-tracing
// for cubic equations and computation of bounding boxes.
// Perform eigenvalue decomposition.
var eigenValueDecomposition = new EigenvalueDecompositionF(inertia.ToMatrixF());
inertiaDiagonal = eigenValueDecomposition.RealEigenvalues.ToVector3F();
rotation = eigenValueDecomposition.V.ToMatrix33F();
if (!rotation.IsRotation)
{
// V is orthogonal but not necessarily a rotation. If it is no rotation
// we have to swap two columns.
MathHelper.Swap(ref inertiaDiagonal.Y, ref inertiaDiagonal.Z);
Vector3F dummy = rotation.GetColumn(1);
rotation.SetColumn(1, rotation.GetColumn(2));
rotation.SetColumn(2, dummy);
Debug.Assert(rotation.IsRotation);
}
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:38,代码来源:MassHelper.cs
示例9: PoseTest
public void PoseTest()
{
CameraInstance cameraInstance = new CameraInstance(new Camera(new PerspectiveProjection()));
Assert.IsNotNull(cameraInstance.PoseWorld);
Assert.AreEqual(Vector3F.Zero, cameraInstance.PoseWorld.Position);
Assert.AreEqual(Matrix33F.Identity, cameraInstance.PoseWorld.Orientation);
// Set new Pose
Vector3F position = new Vector3F(1, 2, 3);
QuaternionF orientation = QuaternionF.CreateRotation(new Vector3F(3, 4, 5), 0.123f);
cameraInstance.PoseWorld = new Pose(position, orientation);
Assert.AreEqual(position, cameraInstance.PoseWorld.Position);
Assert.AreEqual(orientation.ToRotationMatrix33(), cameraInstance.PoseWorld.Orientation);
Assert.IsTrue(Matrix44F.AreNumericallyEqual(cameraInstance.PoseWorld.ToMatrix44F(), cameraInstance.ViewInverse));
Assert.IsTrue(Matrix44F.AreNumericallyEqual(cameraInstance.PoseWorld.Inverse.ToMatrix44F(), cameraInstance.View));
// Set Position and Orientation
position = new Vector3F(5, 6, 7);
orientation = QuaternionF.CreateRotation(new Vector3F(1, -1, 6), -0.123f);
cameraInstance.PoseWorld = new Pose(position, orientation);
Assert.AreEqual(position, cameraInstance.PoseWorld.Position);
Assert.AreEqual(orientation.ToRotationMatrix33(), cameraInstance.PoseWorld.Orientation);
Assert.IsTrue(Matrix44F.AreNumericallyEqual(cameraInstance.PoseWorld.Inverse.ToMatrix44F(), cameraInstance.View));
Assert.IsTrue(Matrix44F.AreNumericallyEqual(cameraInstance.PoseWorld.ToMatrix44F(), cameraInstance.ViewInverse));
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:25,代码来源:CameraInstanceTest.cs
示例10: KinectWrapper
//--------------------------------------------------------------
public KinectWrapper(Game game)
: base(game)
{
Offset = new Vector3F(0, 0, 0);
Scale = new Vector3F(1, 1, 1);
InitializeSkeletonPoses();
}
开发者ID:HATtrick-games,项目名称:ICT309,代码行数:8,代码来源:KinectWrapper.cs
示例11: RedSquareObject
public RedSquareObject(Vector3F position)
{
_position = position;
_color = new Vector4(1.0f, 0.0f, 0.0f, 1.0f);
var graphicsService = ServiceLocator.Current.GetInstance<IGraphicsService>();
var screen = ((GameScreen)graphicsService.Screens["Default"]);
var contentManager = ServiceLocator.Current.GetInstance<ContentManager>();
_model = contentManager.Load<ModelNode>("redSquare").Clone();
screen.Scene.Children.Add(_model);
_model.PoseWorld = new Pose(_position);
foreach (var meshNode in _model.GetSubtree().OfType<MeshNode>())
{
Mesh mesh = meshNode.Mesh;
foreach (var material in mesh.Materials)
{
var effectBinding = material["Default"];
effectBinding.Set("DiffuseColor", _color);
((BasicEffectBinding)effectBinding).LightingEnabled = false;
}
}
InUse = true;
}
开发者ID:HATtrick-games,项目名称:ICT309,代码行数:28,代码来源:RedSquareObject.cs
示例12: GetClosestPointCandidates
public void GetClosestPointCandidates(Vector3F scale, Pose pose, ISpatialPartition<int> otherPartition, Vector3F otherScale, Pose otherPose, Func<int, int, float> callback)
{
if (otherPartition == null)
throw new ArgumentNullException("otherPartition");
if (callback == null)
throw new ArgumentNullException("callback");
// Make sure we are up-to-date.
var otherBasePartition = otherPartition as BasePartition<int>;
if (otherBasePartition != null)
otherBasePartition.UpdateInternal();
else
otherPartition.Update(false);
Update(false);
if (_numberOfItems == 0)
return;
if (otherPartition is ISupportClosestPointQueries<int>)
{
// ----- CompressedAabbTree vs. ISupportClosestPointQueries<int>
GetClosestPointCandidatesImpl(scale, pose, (ISupportClosestPointQueries<int>)otherPartition, otherScale, otherPose, callback);
}
else
{
// ----- CompressedAabbTree vs. *
GetClosestPointCandidatesImpl(otherPartition, callback);
}
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:31,代码来源:CompressedAabbTree_TreeVsTree.cs
示例13: Addition
public void Addition()
{
Vector3F a = new Vector3F(1.0f, 2.0f, 3.0f);
Vector3F b = new Vector3F(2.0f, 3.0f, 4.0f);
Vector3F c = Vector3F.Add(a, b);
Assert.AreEqual(new Vector3F(3.0f, 5.0f, 7.0f), c);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:Vector3FTest.cs
示例14: Normalize
public void Normalize()
{
Vector3F v, n1, n2;
float magnitude;
v = new Vector3F(3.0f, 4.0f, 0.0f);
n1 = v.Normalize();
n2 = v.Normalize(out magnitude);
Assert.AreEqual(1.0f, n1.Magnitude, 1e-7);
Assert.AreEqual(1.0f, n2.Magnitude, 1e-7);
Assert.AreEqual(5.0f, magnitude, 1e-7);
v = new Vector3F(3.0f, 0.0f, 4.0f);
n1 = v.Normalize();
n2 = v.Normalize(out magnitude);
Assert.AreEqual(1.0f, n1.Magnitude, 1e-7);
Assert.AreEqual(1.0f, n2.Magnitude, 1e-7);
Assert.AreEqual(5.0f, magnitude, 1e-7);
v = new Vector3F(0.0f, 3.0f, 4.0f);
n1 = v.Normalize();
n2 = v.Normalize(out magnitude);
Assert.AreEqual(1.0f, n1.Magnitude, 1e-7);
Assert.AreEqual(1.0f, n2.Magnitude, 1e-7);
Assert.AreEqual(5.0f, magnitude, 1e-7);
}
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:26,代码来源:Vector3FTests.cs
示例15: GodRayFilter
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="GodRayFilter"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public GodRayFilter(IGraphicsService graphicsService)
: base(graphicsService)
{
Effect effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/GodRayFilter");
_viewportSizeParameter = effect.Parameters["ViewportSize"];
_parameters0Parameter = effect.Parameters["Parameters0"];
_parameters1Parameter = effect.Parameters["Parameters1"];
_intensityParameter = effect.Parameters["Intensity"];
_numberOfSamplesParameter = effect.Parameters["NumberOfSamples"];
_sourceTextureParameter = effect.Parameters["SourceTexture"];
_gBuffer0Parameter = effect.Parameters["GBuffer0"];
_rayTextureParameter = effect.Parameters["RayTexture"];
_createMaskPass = effect.CurrentTechnique.Passes["CreateMask"];
_blurPass = effect.CurrentTechnique.Passes["Blur"];
_combinePass = effect.CurrentTechnique.Passes["Combine"];
_downsampleFilter = graphicsService.GetDownsampleFilter();
Scale = 1;
LightDirection = new Vector3F(0, -1, 0);
LightRadius = 0.2f;
Intensity = new Vector3F(1, 1, 1);
DownsampleFactor = 4;
NumberOfSamples = 8;
NumberOfPasses = 2;
Softness = 1;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:35,代码来源:GodRayFilter.cs
示例16: GenData
private float[] GenData(Vector3F origin, int width, int height, int depth)
{
var data = new float[width*height*depth];
for (var x = 0; x < width; x++)
{
for (var y = 0; y < height; y++)
{
for (var z = 0; z < depth; z++)
{
var i = x + width*(y + height*z);
if (y == height - 1)
{
data[i] = -1;
continue;
}
if (y == 0)
{
data[i] = 1;
continue;
}
data[i] = (float) _b.Get(_seed, origin.x + x, origin.y + y, origin.z + z, OpenSimplex.Get);
}
}
}
return data;
}
开发者ID:dvdbrink,项目名称:Procedural,代码行数:29,代码来源:ThreadedChunkGenerator.cs
示例17: Prepare
public override bool Prepare(Vector3I[] marks) {
a = marks[0];
b = marks[1];
c = marks[2];
if (a == b || b == c || c == a) {
if (a != c) b = c;
isLine = true;
}
Bounds = new BoundingBox(
Math.Min(Math.Min(a.X, b.X), c.X),
Math.Min(Math.Min(a.Y, b.Y), c.Y),
Math.Min(Math.Min(a.Z, b.Z), c.Z),
Math.Max(Math.Max(a.X, b.X), c.X),
Math.Max(Math.Max(a.Y, b.Y), c.Y),
Math.Max(Math.Max(a.Z, b.Z), c.Z)
);
Coords = Bounds.MinVertex;
if (!base.Prepare(marks)) return false;
normal = (b - a).Cross(c - a);
normalF = normal.Normalize();
BlocksTotalEstimate = GetBlockTotalEstimate();
s1 = normal.Cross(a - b).Normalize();
s2 = normal.Cross(b - c).Normalize();
s3 = normal.Cross(c - a).Normalize();
return true;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:33,代码来源:TriangleDrawOperation.cs
示例18: Prepare
public override bool Prepare(Vector3I[] marks)
{
a = marks[0];
c = marks[1];
b = marks[2];
d = new Vector3I(a.X + c.X - b.X, a.Y + c.Y - b.Y, a.Z + c.Z - b.Z);
Bounds = new BoundingBox(
Math.Min(Math.Min(a.X, b.X), Math.Min(c.X, d.X)),
Math.Min(Math.Min(a.Y, b.Y), Math.Min(c.Y, d.Y)),
Math.Min(Math.Min(a.Z, b.Z), Math.Min(c.Z, d.Z)),
Math.Max(Math.Max(a.X, b.X), Math.Max(c.X, d.X)),
Math.Max(Math.Max(a.Y, b.Y), Math.Max(c.Y, d.Y)),
Math.Max(Math.Max(a.Z, b.Z), Math.Max(c.Z, d.Z))
);
Coords = Bounds.MinVertex;
if (!base.Prepare(marks))
return false;
normal = (b - a).Cross(c - a);
normalF = normal.Normalize();
BlocksTotalEstimate = GetBlockTotalEstimate();
s1 = normal.Cross(a - b).Normalize();
s2 = normal.Cross(b - c).Normalize();
s3 = normal.Cross(c - d).Normalize();
s4 = normal.Cross(d - a).Normalize();
return true;
}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:33,代码来源:PlaneDrawOperation.cs
注:本文中的Vector3F类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论