本文整理汇总了C#中Vector3I类的典型用法代码示例。如果您正苦于以下问题:C# Vector3I类的具体用法?C# Vector3I怎么用?C# Vector3I使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3I类属于命名空间,在下文中一共展示了Vector3I类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BlockUpdate
public BlockUpdate( Player origin, Vector3I coord, Block blockType ) {
Origin = origin;
X = (short)coord.X;
Y = (short)coord.Y;
Z = (short)coord.Z;
BlockType = blockType;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:BlockUpdate.cs
示例2: AssertRangeIsInside
private void AssertRangeIsInside(int lodIndex, ref Vector3I globalMin, ref Vector3I globalMax)
{
var leafMinInLod = m_leafMin >> lodIndex;
var leafMaxInLod = m_leafMax >> lodIndex;
Debug.Assert(globalMin.IsInsideInclusive(ref leafMinInLod, ref leafMaxInLod));
Debug.Assert(globalMax.IsInsideInclusive(ref leafMinInLod, ref leafMaxInLod));
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:7,代码来源:MyProviderLeaf.cs
示例3: VoxelChunk
public VoxelChunk(Vector3I coords)
{
Coords = coords;
Material = new byte[TotalVolume];
Content = new byte[TotalVolume];
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyStorageBase.Cache.cs
示例4: Prepare
public override bool Prepare( Vector3I[] marks )
{
if( Player.World == null ) PlayerOpException.ThrowNoWorld( Player );
if( !base.Prepare( marks ) ) return false;
BlocksTotalEstimate = Bounds.Volume;
Coords = Bounds.MinVertex;
// remember dimensions and orientation
CopyState copyInfo = new CopyState( marks[0], marks[1] );
for( int x = Bounds.XMin; x <= Bounds.XMax; x++ ) {
for( int y = Bounds.YMin; y <= Bounds.YMax; y++ ) {
for( int z = Bounds.ZMin; z <= Bounds.ZMax; z++ ) {
copyInfo.Buffer[x - Bounds.XMin, y - Bounds.YMin, z - Bounds.ZMin] = Map.GetBlock( x, y, z );
}
}
}
copyInfo.OriginWorld = Player.World.Name;
copyInfo.CopyTime = DateTime.UtcNow;
Player.SetCopyInformation( copyInfo );
Player.Message( "{0} blocks cut into slot #{1}. You can now &H/Paste",
Bounds.Volume, Player.CopySlot + 1 );
Player.Message( "Origin at {0} {1}{2} corner.",
(copyInfo.Orientation.X == 1 ? "bottom" : "top"),
(copyInfo.Orientation.Y == 1 ? "south" : "north"),
(copyInfo.Orientation.Z == 1 ? "east" : "west") );
Context |= BlockChangeContext.Cut;
return true;
}
开发者ID:Bedrok,项目名称:800craft,代码行数:32,代码来源:CutDrawOperation.cs
示例5: BreakBlockEffect
public void BreakBlockEffect( Vector3I position, byte block )
{
Vector3 startPos = new Vector3( position.X, position.Y, position.Z );
int texLoc = game.BlockInfo.GetTextureLoc( block, TileSide.Left );
TextureRec rec = game.TerrainAtlas.GetTexRec( texLoc );
float invSize = TerrainAtlas2D.invElementSize;
int cellsCountX = (int)( 0.25f / invSize );
int cellsCountY = (int)( 0.25f / invSize );
float elementXSize = invSize * 0.25f;
float elementYSize = invSize * 0.25f;
Random rnd = new Random();
for( int i = 0; i < 25; i++ ) {
double velX = ( rnd.NextDouble() * 0.8/*5*/ ) - 0.4/*0.25*/;
double velZ = ( rnd.NextDouble() * 0.8/*5*/ ) - 0.4/*0.25*/;
double velY = ( rnd.NextDouble() + 0.25 ) * game.BlockInfo.Height[block];
Vector3 velocity = new Vector3( (float)velX, (float)velY, (float)velZ );
double xOffset = rnd.NextDouble() - 0.125;
double yOffset = rnd.NextDouble() - 0.125;
double zOffset = rnd.NextDouble() - 0.125;
Vector3 pos = startPos + new Vector3( (float)xOffset, (float)yOffset, (float)zOffset );
TextureRec particleRec = rec;
particleRec.U1 = (float)( rec.U1 + rnd.Next( 0, cellsCountX ) * elementXSize );
particleRec.V1 = (float)( rec.V1 + rnd.Next( 0, cellsCountY ) * elementYSize );
particleRec.U2 = particleRec.U1 + elementXSize;
particleRec.V2 = particleRec.V1 + elementYSize;
double life = 1.5 - rnd.NextDouble();
particles.Add( new TerrainParticle( game, pos, velocity, life, particleRec ) );
}
}
开发者ID:Daribon,项目名称:ClassicalSharp,代码行数:32,代码来源:ParticleManager.cs
示例6: CopyState
public CopyState( Vector3I mark1, Vector3I mark2 ) {
BoundingBox box = new BoundingBox( mark1, mark2 );
Orientation = new Vector3I( mark1.X <= mark2.X ? 1 : -1,
mark1.Y <= mark2.Y ? 1 : -1,
mark1.Z <= mark2.Z ? 1 : -1 );
Buffer = new Block[box.Width, box.Length, box.Height];
}
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:CopyState.cs
示例7: CopyTo
/// <summary>
/// Copies part of skeleton to other skeleton, both positions are inclusive
/// </summary>
public void CopyTo(MyGridSkeleton target, Vector3I fromGridPosition, Vector3I toGridPosition)
{
Vector3I baseBonePos = fromGridPosition * BoneDensity;
Vector3I max = (toGridPosition - fromGridPosition + Vector3I.One) * BoneDensity;
Vector3I boneOffset;
for (boneOffset.X = 0; boneOffset.X <= max.X; boneOffset.X++)
{
for (boneOffset.Y = 0; boneOffset.Y <= max.Y; boneOffset.Y++)
{
for (boneOffset.Z = 0; boneOffset.Z <= max.Z; boneOffset.Z++)
{
Vector3I bonePos = baseBonePos + boneOffset;
Vector3 bone;
if (Bones.TryGetValue(bonePos, out bone))
{
target.Bones[bonePos] = bone;
}
else
{
target.Bones.Remove(bonePos);
}
}
}
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:29,代码来源:MyGridSkeleton.cs
示例8: Prepare
public override bool Prepare( Vector3I[] marks )
{
if ( !base.Prepare( marks ) )
return false;
// center of the torus
center = marks[0];
Vector3I radiusVector = ( marks[1] - center ).Abs();
// tube radius is figured out from Z component of the mark vector
tubeR = radiusVector.Z;
// torus radius is figured out from length of vector's X-Y components
bigR = Math.Sqrt( radiusVector.X * radiusVector.X +
radiusVector.Y * radiusVector.Y + .5 );
// tube + torus radius, rounded up. This will be the maximum extend of the torus.
int combinedRadius = ( int )Math.Ceiling( bigR + tubeR );
// vector from center of torus to the furthest-away point of the bounding box
Vector3I combinedRadiusVector = new Vector3I( combinedRadius, combinedRadius, tubeR + 1 );
// adjusted bounding box
Bounds = new BoundingBox( center - combinedRadiusVector, center + combinedRadiusVector );
BlocksTotalEstimate = ( int )( 2 * Math.PI * Math.PI * bigR * ( tubeR * tubeR + Bias ) );
coordEnumerator = BlockEnumerator().GetEnumerator();
return true;
}
开发者ID:GlennMR,项目名称:800craft,代码行数:31,代码来源:TorusDrawOperation.cs
示例9: BlockEnumerator
IEnumerable<Vector3I> BlockEnumerator(Vector3I min, Vector3I max)
{
for( int x = min.X; x <= max.X; x++ ) {
for( int y = min.Y; y <= max.Y; y++ ) {
yield return new Vector3I( x, y, min.Z );
if( min.Z != max.Z ) {
yield return new Vector3I( x, y, max.Z );
}
}
}
if((max.Z - min.Z + 1) > 2) {
for( int x = min.X; x <= max.X; x++ ) {
for( int z = min.Z + 1; z < max.Z; z++ ) {
yield return new Vector3I( x, min.Y, z );
if( min.Y != max.Y ) {
yield return new Vector3I( x, max.Y, z );
}
}
}
for( int y = min.Y + 1; y < max.Y; y++ ) {
for( int z = min.Z + 1; z < max.Z; z++ ) {
yield return new Vector3I( min.X, y, z );
if( min.X != max.X ) {
yield return new Vector3I( max.X, y, z );
}
}
}
}
}
开发者ID:Grivaryg,项目名称:LibClassicBot,代码行数:31,代码来源:CuboidH.cs
示例10: ReadMaterialRange
public override void ReadMaterialRange(MyStorageDataCache target, ref Vector3I writeOffset, int lodIndex, ref Vector3I minInLod, ref Vector3I maxInLod, float lodVoxelSizeHalf)
{
float lodVoxelSize = 2f * lodVoxelSizeHalf;
byte defaultMaterial = m_material.Index;
Vector3I v = new Vector3I();
for (v.Z = minInLod.Z; v.Z <= maxInLod.Z; ++v.Z)
{
for (v.Y = minInLod.Y; v.Y <= maxInLod.Y; ++v.Y)
{
for (v.X = minInLod.X; v.X <= maxInLod.X; ++v.X)
{
var write = v - minInLod + writeOffset;
byte slope = target.Material(ref write);
if (slope == 0) continue;
Vector3 localPos = v * lodVoxelSize;
var mat = GetMaterialForPosition(ref localPos, lodVoxelSize);
target.Material(ref write, mat.Index);
}
}
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:26,代码来源:MyBoxShapeOreDeposit.cs
示例11: BlockFloat
public BlockFloat(World world, Vector3I position, Block Type)
: base(world)
{
_pos = position;
_nextPos = position.Z + 1;
type = Type;
}
开发者ID:venofox,项目名称:AtomicCraft,代码行数:7,代码来源:WaterPhysics.cs
示例12: Unregister
public override void Unregister(MyEntity entity, Vector3I forwardVector)
{
base.Unregister(entity, forwardVector);
var thrust = entity as MyThrust;
if (thrust == null)
return;
thrust.EnabledChanged -= thrust_EnabledChanged;
thrust.SlimBlock.ComponentStack.IsFunctionalChanged -= ComponentStack_IsFunctionalChanged;
// Need to recalculate the slowdown factor. Maybe save different levels of the factors and just revert back to previous one
SlowdownFactor = 0f;
foreach (var direction in Base6Directions.IntDirections)
{
foreach (var dataByType in m_dataByFuelType)
{
foreach (var entityInDirection in dataByType.ThrustsByDirection[direction])
{
var thrustInDirection = entityInDirection as MyThrust;
if (thrustInDirection == null)
continue;
SlowdownFactor = Math.Max(thrustInDirection.BlockDefinition.SlowdownFactor, SlowdownFactor);
}
}
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:27,代码来源:MyThrusterBlockThrustComponent.cs
示例13: AddSelection
public void AddSelection( byte id, Vector3I p1, Vector3I p2, FastColour col )
{
RemoveSelection( id );
SelectionBox selection = new SelectionBox( p1, p2, col );
selection.ID = id;
selections.Add( selection );
}
开发者ID:Retatta,项目名称:ClassicalSharp,代码行数:7,代码来源:SelectionManager.cs
示例14: Prepare
public override bool Prepare( Vector3I[] marks )
{
if( !base.Prepare( marks ) ) return false;
BlocksTotalEstimate = Bounds.Volume;
Coords = Bounds.MinVertex;
return true;
}
开发者ID:GMathioud,项目名称:MyCraft,代码行数:7,代码来源:CuboidDrawOperation.cs
示例15: Start
/// <summary>
/// Executes the drawer on a separate thread. The bool is there if the user finds a need to stop the drawing.
/// (This happens when CancelDrawer() is called.)
/// </summary>
public void Start(ClassicBot main, ref bool Aborted, Vector3I[] points, byte blocktype, ref int sleeptime)
{
Vector3I Coords = Vector3I.Min(points[0], points[1]);
Vector3I MinVertex = Vector3I.Min(points[0], points[1]);
Vector3I MaxVertex = Vector3I.Max(points[0], points[1]);
double rx = (MaxVertex.X - MinVertex.X + 1) / 2d;
double ry = (MaxVertex.Y - MinVertex.Y + 1) / 2d;
double rz = (MaxVertex.Z - MinVertex.Z + 1) / 2d;
radius.X = (float)(1 / (rx * rx));
radius.Y = (float)(1 / (ry * ry));
radius.Z = (float)(1 / (rz * rz));
// find center points
center.X = (float)((MinVertex.X + MaxVertex.X) / 2d);
center.Y = (float)((MinVertex.Y + MaxVertex.Y) / 2d);
center.Z = (float)((MinVertex.Z + MaxVertex.Z) / 2d);
Coords = MinVertex;
main.SendPositionPacket((short)Coords.X, (short)Coords.Y, (short)Coords.Z);
IEnumerator<Vector3I> coordEnumerator = BlockEnumerator(MinVertex, MaxVertex).GetEnumerator();
while(coordEnumerator.MoveNext())
{
if (Aborted == true) {
return;
}
Thread.Sleep(sleeptime);
Coords = coordEnumerator.Current;
main.SendPositionPacket((short)Coords.X, (short)Coords.Y, (short)Coords.Z);
main.SendBlockPacket((short)Coords.X, (short)Coords.Y, (short)Coords.Z, 1, blocktype);
}
main.SetDrawerToNull();
}
开发者ID:Grivaryg,项目名称:LibClassicBot,代码行数:38,代码来源:Ellipsoid.cs
示例16: ReadRange
void ModAPI.Interfaces.IMyStorage.ReadRange(MyStorageDataCache target, MyStorageDataTypeFlags dataToRead, int lodIndex, Vector3I lodVoxelRangeMin, Vector3I lodVoxelRangeMax)
{
if ((uint)lodIndex >= (uint)MyCellCoord.MAX_LOD_COUNT)
return;
ReadRange(target, dataToRead, lodIndex, ref lodVoxelRangeMin, ref lodVoxelRangeMax);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyStorageBase_ModAPI.cs
示例17: GetDirection
public static Direction GetDirection(Vector3I[] marks)
{
if (Math.Abs(marks[1].X - marks[0].X) > Math.Abs(marks[1].Y - marks[0].Y))
{
if (marks[0].X < marks[1].X)
{
return Direction.one;
}
else
{
return Direction.two;
}
}
else if (Math.Abs(marks[1].X - marks[0].X) < Math.Abs(marks[1].Y - marks[0].Y))
{
if (marks[0].Y < marks[1].Y)
{
return Direction.three;
}
else
{
return Direction.four;
}
}
else
return Direction.Null;
}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:27,代码来源:Direction.cs
示例18: MyVoxelPhysicsBody
internal MyVoxelPhysicsBody(MyVoxelMap voxelMap): base(voxelMap, RigidBodyFlag.RBF_STATIC)
{
m_voxelMap = voxelMap;
Vector3I storageSize = m_voxelMap.Size;
Vector3I numCels = storageSize >> MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS_BITS;
m_cellsOffset = m_voxelMap.StorageMin >> MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS_BITS;
HkUniformGridShape shape = new HkUniformGridShape(
new HkUniformGridShapeArgs()
{
CellsCount = numCels,
CellSize = MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_METRES,
CellOffset = MyVoxelConstants.VOXEL_SIZE_IN_METRES_HALF,
CellExpand = MyVoxelConstants.VOXEL_SIZE_IN_METRES,
});
shape.SetShapeRequestHandler(RequestShapeBlocking);
CreateFromCollisionObject(shape, -m_voxelMap.SizeInMetresHalf, m_voxelMap.WorldMatrix, collisionFilter: MyPhysics.StaticCollisionLayer);
shape.Base.RemoveReference();
if (ENABLE_AABB_PHANTOM)
{
m_aabbPhantom = new Havok.HkpAabbPhantom(new BoundingBox(Vector3.Zero, m_voxelMap.SizeInMetres), 0);
m_aabbPhantom.CollidableAdded = AabbPhantom_CollidableAdded;
m_aabbPhantom.CollidableRemoved = AabbPhantom_CollidableRemoved;
}
if (MyFakes.ENABLE_PHYSICS_HIGH_FRICTION)
Friction = 0.65f;
MaterialType = Sandbox.Common.MyMaterialType.ROCK;
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:32,代码来源:MyVoxelPhysicsBody.cs
示例19: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_MultiBlockDefinition;
MyDebug.AssertDebug(ob != null);
if (ob.BlockDefinitions != null && ob.BlockDefinitions.Length > 0)
{
MinPosition = Vector3I.MaxValue;
MaxPosition = Vector3I.MinValue;
BlockDefinitions = new MyMultiBlockPartDefinition[ob.BlockDefinitions.Length];
for (int i = 0; i < ob.BlockDefinitions.Length; ++i)
{
BlockDefinitions[i] = new MyMultiBlockPartDefinition();
var obBlockDef = ob.BlockDefinitions[i];
BlockDefinitions[i].Id = obBlockDef.Id;
BlockDefinitions[i].Position = obBlockDef.Position;
BlockDefinitions[i].Forward = obBlockDef.Orientation.Forward;
BlockDefinitions[i].Up = obBlockDef.Orientation.Up;
MinPosition = Vector3I.Min(MinPosition, obBlockDef.Position);
MaxPosition = Vector3I.Max(MaxPosition, obBlockDef.Position);
}
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:28,代码来源:MyMultiCubeBlockDefinition.cs
示例20: WorldPositionToRenderCellCoord
public static void WorldPositionToRenderCellCoord(Vector3D referenceVoxelMapPosition, ref Vector3D worldPosition, out Vector3I renderCellCoord)
{
Vector3D tmp;
WorldPositionToLocalPosition(referenceVoxelMapPosition, ref worldPosition, out tmp);
tmp /= MyVoxelConstants.RENDER_CELL_SIZE_IN_METRES;
Vector3I.Floor(ref tmp, out renderCellCoord);
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:7,代码来源:MyVoxelCoordSystems.cs
注:本文中的Vector3I类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论