本文整理汇总了C#中Microsoft.Xna.Framework.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# Vector3类的具体用法?C# Vector3怎么用?C# Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3类属于Microsoft.Xna.Framework命名空间,在下文中一共展示了Vector3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Reset
// Reset
public void Reset()
{
Offset = new Vector2();
Scale = new Vector2( 1.0f );
Rotation = new Vector3();
TransformMatrix = Matrix.Identity;
}
开发者ID:JacobNorlin,项目名称:project-duck,代码行数:8,代码来源:CameraSettings.cs
示例2: Stairs
public Stairs(Vector3 position, bool westEast, bool shapeL) : base(position)
{
Position = position;
var original = new CubeGraphic { Position = position, DrawFaces = CubeFaces.All ^ CubeFaces.Front ^ CubeFaces.Floor };
var nextFloor = new CubeGraphic { Position = original.Position + Vector3.Down, DrawFaces = CubeFaces.Sides ^ CubeFaces.Front };
var stairs = new ModelGraphic { Position = nextFloor.Position };
original.Texture = nextFloor.Texture = nextFloor.Resources.Content.Load<Texture2D>("Textures/Wall");
if (shapeL)
{
stairs.Model = stairs.Resources.Content.Load<Model>("Models/stairs1");
if (westEast)
nextFloor.DrawFaces ^= CubeFaces.Right;
else
nextFloor.DrawFaces ^= CubeFaces.Left;
}
else
{
stairs.Model = stairs.Resources.Content.Load<Model>("Models/stairs");
nextFloor.DrawFaces ^= CubeFaces.Back;
}
if (westEast)
{
original.Rotation = nextFloor.Rotation = new Vector3(0, MathHelper.PiOver2, 0);
stairs.Rotation = new Vector3(0, MathHelper.PiOver2, 0);
stairs.MirrorX = true;
}
graphics = new GraphicsCollection(original, nextFloor, stairs);
graphicsProviders.SubProviders.Add(graphics);
}
开发者ID:ggrrin,项目名称:DungeonMaster,代码行数:35,代码来源:Stairs.cs
示例3: Initialize
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
zNear = 0.001f;
zFar = 1000.0f;
fov = MathHelper.Pi * 70.0f / 180.0f;
eye = new Vector3(0.0f, 0.7f, 1.5f);
at = new Vector3(0.0f, 0.0f, 0.0f);
up = new Vector3(0.0f, 1.0f, 0.0f);
cube = new VertexPositionColor[8];
cube[0] = new VertexPositionColor(new Vector3(-0.5f, -0.5f, -0.5f), new Color(0.0f, 0.0f, 0.0f));
cube[1] = new VertexPositionColor(new Vector3(-0.5f, -0.5f, 0.5f), new Color(0.0f, 0.0f, 1.0f));
cube[2] = new VertexPositionColor(new Vector3(-0.5f, 0.5f, -0.5f), new Color(0.0f, 1.0f, 0.0f));
cube[3] = new VertexPositionColor(new Vector3(-0.5f, 0.5f, 0.5f), new Color(0.0f, 1.0f, 1.0f));
cube[4] = new VertexPositionColor(new Vector3( 0.5f, -0.5f, -0.5f), new Color(1.0f, 0.0f, 0.0f));
cube[5] = new VertexPositionColor(new Vector3( 0.5f, -0.5f, 0.5f), new Color(1.0f, 0.0f, 1.0f));
cube[6] = new VertexPositionColor(new Vector3( 0.5f, 0.5f, -0.5f), new Color(1.0f, 1.0f, 0.0f));
cube[7] = new VertexPositionColor(new Vector3( 0.5f, 0.5f, 0.5f), new Color(1.0f, 1.0f, 1.0f));
vertexBuffer = new DynamicVertexBuffer(graphics.GraphicsDevice, typeof(VertexPositionColor), 8, BufferUsage.WriteOnly);
indexBuffer = new DynamicIndexBuffer(graphics.GraphicsDevice, typeof(ushort), 36, BufferUsage.WriteOnly);
basicEffect = new BasicEffect(graphics.GraphicsDevice); //(device, null);
basicEffect.LightingEnabled = false;
basicEffect.VertexColorEnabled = true;
basicEffect.TextureEnabled = false;
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
base.Initialize();
}
开发者ID:BrainSlugs83,项目名称:MonoGame,代码行数:37,代码来源:Game1.cs
示例4: GameObject
/// <summary>
/// Constructor de la clase GameObject.
/// </summary>
/// <param name="effect">Effecto usado para dibujar.</param>
/// <param name="engine">Clase principal del juego.</param>
/// <param name="size">Tamaño del objeto.</param>
/// <param name="position">Posicion x, y, z dada como Vector3.</param>
/// <param name="color">Color del objeto.</param>
public GameObject(Engine engine, Vector3 position, Color color, float size)
: base(engine)
{
this.size = size;
this.color = color;
this.position = position;
}
开发者ID:alejopelaez,项目名称:eshcerworld,代码行数:15,代码来源:GameObject.cs
示例5: Net
public Net(Vector3 position, int numBlocksX, int numBlocksY, float blockWidth, float blockHeight, Color color)
{
this.primitivesCount = numBlocksX + numBlocksY + 2;
this.primitives = new IPrimitive[this.primitivesCount];
GenerateNet(numBlocksX, numBlocksY, blockWidth, blockHeight, position, color);
}
开发者ID:AleksandarDev,项目名称:LD26,代码行数:7,代码来源:Net.cs
示例6: AudioListener
public AudioListener()
{
this.Forward = Vector3.Forward;
this.Position = Vector3.Zero;
this.Up = Vector3.Up;
this.Velocity = Vector3.Zero;
}
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:AudioListener.cs
示例7: LocalSpace
public LocalSpace(Vector3 up, Vector3 forward, Vector3 position)
{
_up = up;
_forward = forward;
_position = position;
SetUnitSideFromForwardAndUp();
}
开发者ID:Simie,项目名称:SharpSteer2,代码行数:7,代码来源:LocalSpace.cs
示例8: Draw
public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
{
if (!m_AllowDefer)
{
if (CheckDefer(map, drawPosition))
return false;
}
else
{
m_AllowDefer = false;
}
int displayItemdID = (m_Animated) ? Effect.ItemID + ((Effect.FramesActive / m_AnimData.FrameInterval) % m_AnimData.FrameCount) : Effect.ItemID;
if (displayItemdID != m_DisplayItemID)
{
m_DisplayItemID = displayItemdID;
IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
DrawTexture = provider.GetItemTexture(m_DisplayItemID);
DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER, DrawTexture.Width, DrawTexture.Height);
PickType = PickType.PickNothing;
DrawFlip = false;
}
DrawArea.X = 0 - (int)((Entity.Position.X_offset - Entity.Position.Y_offset) * 22);
DrawArea.Y = 0 + (int)((Entity.Position.Z_offset + Entity.Z) * 4) - (int)((Entity.Position.X_offset + Entity.Position.Y_offset) * 22);
Rotation = Effect.AngleToTarget;
// Update hue vector.
HueVector = Utility.GetHueVector(Entity.Hue);
return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
}
开发者ID:InjectionDev,项目名称:UltimaXNA,代码行数:34,代码来源:MovingEffectView.cs
示例9: IsInsidePath
// is the given point inside the path tube?
public bool IsInsidePath(Vector3 point)
{
float outside;
Vector3 tangent;
MapPointToPath(point, out tangent, out outside);
return outside < 0;
}
开发者ID:hgrandry,项目名称:Mgx,代码行数:8,代码来源:Pathway.cs
示例10: HowFarOutsidePath
// how far outside path tube is the given point? (negative is inside)
public float HowFarOutsidePath(Vector3 point)
{
float outside;
Vector3 tangent;
MapPointToPath(point, out tangent, out outside);
return outside;
}
开发者ID:hgrandry,项目名称:Mgx,代码行数:8,代码来源:Pathway.cs
示例11: GetBoundingSphere
public BoundingSphere GetBoundingSphere(Vector3 aLowest, Vector3 aHighest, Vector3 aTranslation, Vector3 aTile)
{
Vector3 temporaryRadius = new Vector3((aHighest.X - aLowest.X) / 2, (aHighest.Y - aLowest.Y) / 2, (aHighest.Z - aLowest.Z) / 2) * aTile;
BoundingSphere temporarySphere = new BoundingSphere(aTranslation, (temporaryRadius.X + temporaryRadius.Y + temporaryRadius.Z) / 3);
return temporarySphere;
}
开发者ID:JonathanMcCaffrey,项目名称:tank-gauntlet,代码行数:7,代码来源:UtilityManager.cs
示例12: Circle2D
public Circle2D(Vector3 position, float innerRadius, float thickness, Color color)
{
Position = position;
InnerRadius = innerRadius;
Thickness = thickness;
Color = color;
}
开发者ID:JaapSuter,项目名称:Pentacorn,代码行数:7,代码来源:Circle2D.cs
示例13: Draw
public virtual void Draw()
{
if (this.GetPositionZ() > 10)
{
_position += VerticalVelocity;
}
_position += HorizontalVelocity;
var w = _world*Matrix.CreateTranslation(_position);
foreach (ModelMesh mesh in _model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.LightingEnabled = true;
effect.AmbientLightColor = CurrentColor;
effect.DirectionalLight0.Direction = Vector3.Down;
effect.DirectionalLight0.DiffuseColor = DiffuseColor;
effect.DirectionalLight0.Enabled = true;
effect.View = _view;
effect.Projection = _projection;
effect.World = _transforms[mesh.ParentBone.Index] * w;
}
mesh.Draw();
}
}
开发者ID:Otaman,项目名称:ZigZagGame,代码行数:28,代码来源:Block.cs
示例14: Camera
public Camera(Game game, Vector3 position, Vector3 target, Vector3 upVector)
: base(game)
{
this.position = position;
this.target = target;
this.upVector = upVector;
}
开发者ID:0xdeafcafe,项目名称:VisualForge,代码行数:7,代码来源:Camera.cs
示例15: KeyPressed
private void KeyPressed()
{
Vector3 direction = new Vector3();
KeyboardState keyState = Keyboard.GetState();
if (keyState.IsKeyDown(Keys.A))
{
direction += new Vector3(-4f, 0, 0);
}
if (keyState.IsKeyDown(Keys.D))
{
direction += new Vector3(4f, 0, 0);
}
if (keyState.IsKeyDown(Keys.W))
{
direction += new Vector3(0, 0, 4f);
}
if (keyState.IsKeyDown(Keys.S))
{
direction += new Vector3(0, 0, -4f);
}
CameraTranslate(direction);
}
开发者ID:Andrusza,项目名称:PiratesArr,代码行数:27,代码来源:Input.cs
示例16: VertexPositionNormalTextureHue
public VertexPositionNormalTextureHue(Vector3 position, Vector3 normal, Vector3 textureCoordinate)
{
Position = position;
Normal = normal;
TextureCoordinate = textureCoordinate;
Hue = Vector3.Zero;
}
开发者ID:gautamabudha,项目名称:UltimaXNA,代码行数:7,代码来源:VertexPositionNormalTextureHue.cs
示例17: PrimitiveDeBase
protected PrimitiveDeBase(Game jeu, float homothétieInitiale, Vector3 rotationInitiale, Vector3 positionInitiale)
: base(jeu)
{
HomothétieInitiale = homothétieInitiale;
RotationInitiale = rotationInitiale;
PositionInitiale = positionInitiale;
}
开发者ID:LesMasterSOFA,项目名称:Le-Biere-Pong,代码行数:7,代码来源:PrimitiveDeBase.cs
示例18: Reset
public virtual void Reset()
{
Position = Vector3.Zero;
Velocity = Vector3.Zero;
Direction = new Vector3(1.0f, 1.0f, 1.0f);
IsAlive = true;
}
开发者ID:ruicaridade,项目名称:IP3D,代码行数:7,代码来源:Particle.cs
示例19: Initialize
//Initialisieren der Anfangswerte
public override void Initialize()
{
Position = new Vector3(0, 5, 0);
lookAt = new Vector3(0, 5, -1);
upVector = Vector3.Up;
rightVector = Vector3.Right;
Direction = Vector3.Forward;
ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f),
Game.GraphicsDevice.Viewport.AspectRatio,
NearPlane,
FarPlane);
ViewMatrix = Matrix.CreateLookAt(
Position,
lookAt,
upVector
);
//Setzen der Mauszeigerposition auf die Mitte des Schirmes
Mouse.SetPosition(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height / 2);
originalMouseState = Mouse.GetState();
base.Initialize();
}
开发者ID:steinbergerbernd,项目名称:Shaders,代码行数:27,代码来源:FreeCamera.cs
示例20: Camera
public Camera(Entity target)
{
_target = target;
//todo: Change back to 0, 15, 5
_offsetDistance = new Vector3(0, 40, 5);
ResetCamera();
}
开发者ID:DynaStudios,项目名称:LD24Jam,代码行数:7,代码来源:Camera.cs
注:本文中的Microsoft.Xna.Framework.Vector3类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论