本文整理汇总了C#中VRage.Voxels.MyCellCoord类的典型用法代码示例。如果您正苦于以下问题:C# MyCellCoord类的具体用法?C# MyCellCoord怎么用?C# MyCellCoord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyCellCoord类属于VRage.Voxels命名空间,在下文中一共展示了MyCellCoord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCell
public IMyClipmapCell CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix)
{
var cell = new MyClipmapCellProxy(cellCoord, ref worldMatrix, m_massiveCenter, m_massiveRadius, m_renderFlags);
cell.SetVisibility(false);
cell.ScaleGroup = scaleGroup;
return cell;
}
示例2: MarkBlockChanged
// Actually, this function marks even cubes around the block to make sure that any changes caused in their triangles
// will be reflected in the navigation mesh.
public void MarkBlockChanged(MySlimBlock block)
{
Vector3I min = block.Min - Vector3I.One;
Vector3I max = block.Max + Vector3I.One;
Vector3I pos = min;
for (var it = new Vector3I.RangeIterator(ref block.Min, ref block.Max); it.IsValid(); it.GetNext(out pos))
{
m_changedCubes.Add(pos);
}
Vector3I minCell = CubeToCell(ref min);
Vector3I maxCell = CubeToCell(ref max);
pos = minCell;
for (var it = new Vector3I.RangeIterator(ref minCell, ref maxCell); it.IsValid(); it.GetNext(out pos))
{
m_changedCells.Add(pos);
MyCellCoord cellCoord = new MyCellCoord(0, pos);
ulong packedCell = cellCoord.PackId64();
TryClearCell(packedCell);
}
}
示例3: MyRenderVoxelCell
public MyRenderVoxelCell(MyClipmapScaleEnum scaleGroup, MyCellCoord coord, ref MatrixD worldMatrix)
: base(0, "MyRenderVoxelCell", RenderFlags.Visible | RenderFlags.CastShadows, CullingOptions.VoxelMap)
{
m_scaleGroup = scaleGroup;
m_coord = coord;
m_worldMatrix = worldMatrix;
m_fakeVoxelMaterial.DrawTechnique = MyMeshDrawTechnique.VOXEL_MAP;
}
示例4: MyRenderVoxelCellBackground
public MyRenderVoxelCellBackground(MyCellCoord coord, ref MatrixD worldMatrix, Vector3D position, float atmoshpereRadius, float planetRadius, bool hasAtmosphere) :
base(MyClipmapScaleEnum.Massive, coord, ref worldMatrix)
{
m_atmosphereRadius = atmoshpereRadius;
m_planetRadius = planetRadius;
m_hasAtmosphere = hasAtmosphere;
m_position = position;
m_leftCornerPositionOffset = worldMatrix.Translation -position;
}
示例5: MyRenderVoxelCell
IMyClipmapCell IMyClipmapCellHandler.CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix)
{
switch (scaleGroup)
{
case MyClipmapScaleEnum.Normal:
return new MyRenderVoxelCell(scaleGroup, cellCoord, ref worldMatrix);
default:
throw new InvalidBranchException();
}
}
示例6: MyClipmapCellProxy
internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix, RenderFlags additionalFlags = 0)
{
m_worldMatrix = worldMatrix;
m_actor = MyActorFactory.CreateSceneObject();
m_actor.SetMatrix(ref worldMatrix);
m_actor.AddComponent(MyComponentFactory<MyFoliageComponent>.Create());
m_lod = cellCoord.Lod;
Mesh = MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod);
m_actor.GetRenderable().SetModel(Mesh);
m_actor.GetRenderable().m_additionalFlags = MyProxiesFactory.GetRenderableProxyFlags(additionalFlags);
}
示例7: MyRenderVoxelCell
IMyClipmapCell IMyClipmapCellHandler.CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix)
{
switch (scaleGroup)
{
case MyClipmapScaleEnum.Normal:
return new MyRenderVoxelCell(scaleGroup, cellCoord, ref worldMatrix);
case MyClipmapScaleEnum.Massive:
return new MyRenderVoxelCellBackground(cellCoord, ref worldMatrix, m_position, m_atmosphereRadius, m_planetRadius, m_hasAtmosphere);
default:
throw new InvalidBranchException();
}
}
示例8: MyClipmapCellProxy
internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.Matrix worldMatrix)
{
m_worldMatrix = worldMatrix;
m_actor = MyActorFactory.CreateSceneObject();
//m_mesh = new MyVoxelMesh(cellCoord.CoordInLod, cellCoord.Lod, "");
//m_actor.GetRenderable().SetModel(m_mesh);
m_actor.SetMatrix(ref worldMatrix);
m_actor.AddComponent(MyComponentFactory<MyFoliageComponent>.Create());
m_lod = cellCoord.Lod;
Mesh = MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod);
m_actor.GetRenderable().SetModel(Mesh);
m_discardingOn = false;
}
示例9: InvalidateRange
internal void InvalidateRange(Vector3I lodMin, Vector3I lodMax)
{
var cell = new MyCellCoord(m_lodIndex, lodMin);
for (var it = new Vector3I.RangeIterator(ref lodMin, ref lodMax);
it.IsValid(); it.GetNext(out cell.CoordInLod))
{
CellData data;
var id = cell.PackId64();
using (m_storedCellDataLock.AcquireSharedUsing())
{
if (m_storedCellData.TryGetValue(id, out data))
{
data.State = CellState.Invalid;
}
}
}
}
示例10: OnTaskComplete
internal void OnTaskComplete(MyCellCoord coord, HkBvCompressedMeshShape childShape)
{
Debug.Assert(RigidBody != null, "RigidBody in voxel physics is null! This must not happen.");
if (RigidBody != null)
{
HkUniformGridShape shape = GetShape(coord.Lod);
Debug.Assert(shape.Base.IsValid);
shape.SetChild(coord.CoordInLod.X, coord.CoordInLod.Y, coord.CoordInLod.Z, childShape, HkReferencePolicy.None);
//BoundingBoxD worldAabb;
//MyVoxelCoordSystems.GeometryCellCoordToWorldAABB(m_voxelMap.PositionLeftBottomCorner, ref coord, out worldAabb);
//VRageRender.MyRenderProxy.DebugDrawAABB(worldAabb, Color.Green, 1f, 1f, true);
m_needsShapeUpdate = true;
}
}
示例11: RenderCellCoordToLocalPosition
public static void RenderCellCoordToLocalPosition(ref MyCellCoord renderCell, out Vector3D localPosition)
{
localPosition = renderCell.CoordInLod * RenderCellSizeInMeters(renderCell.Lod);
}
示例12: RenderCellCoordToWorldAABB
public static void RenderCellCoordToWorldAABB(Vector3D referenceVoxelMapPosition, ref MyCellCoord renderCell, out BoundingBoxD worldAABB)
{
RenderCellCoordToLocalAABB(ref renderCell, out worldAABB);
worldAABB = worldAABB.Translate(referenceVoxelMapPosition);
}
示例13: RenderCellCoordToLocalAABB
public static void RenderCellCoordToLocalAABB(ref MyCellCoord renderCell, out BoundingBoxD localAABB)
{
Vector3D localMinCorner;
RenderCellCoordToLocalPosition(ref renderCell, out localMinCorner);
localAABB = new BoundingBoxD(localMinCorner, localMinCorner + RenderCellSizeInMeters(renderCell.Lod));
}
示例14: GetCell
internal CellData GetCell(ref MyCellCoord cell)
{
MyPrecalcComponent.AssertUpdateThread();
bool isEmpty;
CellData data;
if (TryGetCell(cell, out isEmpty, out data))
{
return data;
}
MyIsoMesh mesh;
if (!TryGetMesh(cell, out isEmpty, out mesh))
{
ProfilerShort.Begin("Cell precalc");
if (true)
{
var min = cell.CoordInLod << MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS_BITS;
var max = min + MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS;
// overlap to neighbor; introduces extra data but it makes logic for raycasts simpler (no need to check neighbor cells)
min -= 1;
max += 2;
mesh = MyPrecalcComponent.IsoMesher.Precalc(m_storage, 0, min, max, false, MyFakes.ENABLE_VOXEL_COMPUTED_OCCLUSION, true);
}
else
{
mesh = MyPrecalcComponent.IsoMesher.Precalc(new MyIsoMesherArgs()
{
Storage = m_storage,
GeometryCell = cell,
});
}
ProfilerShort.End();
}
if (mesh != null)
{
data = new CellData();
data.Init(
mesh.PositionOffset, mesh.PositionScale,
mesh.Positions.GetInternalArray(), mesh.VerticesCount,
mesh.Triangles.GetInternalArray(), mesh.TrianglesCount);
}
if (cell.Lod == 0)
{
using (m_lock.AcquireExclusiveUsing())
{
if (data != null)
{
var key = cell.PackId64();
m_cellsByCoordinate[key] = data;
}
else
{
SetEmpty(ref cell, true);
}
}
}
return data;
}
示例15: storage_RangeChanged
/// <param name="minVoxelChanged">Inclusive min.</param>
/// <param name="maxVoxelChanged">Inclusive max.</param>
private void storage_RangeChanged(Vector3I minChanged, Vector3I maxChanged, MyStorageDataTypeFlags changedData)
{
MyPrecalcComponent.AssertUpdateThread();
ProfilerShort.Begin("MyVoxelGeometry.storage_RangeChanged");
minChanged -= MyPrecalcComponent.InvalidatedRangeInflate;
maxChanged += MyPrecalcComponent.InvalidatedRangeInflate;
m_storage.ClampVoxelCoord(ref minChanged);
m_storage.ClampVoxelCoord(ref maxChanged);
var minCellChanged = minChanged >> MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS_BITS;
var maxCellChanged = maxChanged >> MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS_BITS;
using (m_lock.AcquireExclusiveUsing())
{
if (minCellChanged == Vector3I.Zero && maxCellChanged == m_cellsCount - 1)
{
m_cellsByCoordinate.Clear();
m_coordinateToMesh.Clear();
m_isEmptyCache.Reset();
}
else
{
MyCellCoord cell = new MyCellCoord();
cell.CoordInLod = minCellChanged;
for (var it = new Vector3I_RangeIterator(ref minCellChanged, ref maxCellChanged); it.IsValid(); it.GetNext(out cell.CoordInLod))
{
var key = cell.PackId64();
m_cellsByCoordinate.Remove(key);
m_coordinateToMesh.Remove(key);
SetEmpty(ref cell, false);
}
}
}
ProfilerShort.End();
}