本文整理汇总了C#中HkWorld.UnmarkForWrite方法的典型用法代码示例。如果您正苦于以下问题:C# HkWorld.UnmarkForWrite方法的具体用法?C# HkWorld.UnmarkForWrite怎么用?C# HkWorld.UnmarkForWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HkWorld
的用法示例。
在下文中一共展示了HkWorld.UnmarkForWrite方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StepWorld
private static void StepWorld(HkWorld world)
{
world.ExecutePendingCriticalOperations();
world.UnmarkForWrite();
world.StepSimulation(VRage.Game.MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS * MyFakes.SIMULATION_SPEED);
world.StepSimulation(VRage.Game.MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS * MyFakes.SIMULATION_SPEED);
world.MarkForWrite();
}
示例2: LoadData
public override void LoadData()
{
if (!HkBaseSystem.DestructionEnabled)
{
MyLog.Default.WriteLine("Havok Destruction is not availiable in this build.");
throw new System.InvalidOperationException("Havok Destruction is not availiable in this build.");
}
if (Static != null)
{
MyLog.Default.WriteLine("Destruction data was not freed. Unloading now...");
//throw new System.InvalidOperationException("Destruction data was not freed");
UnloadData();
}
Static = this;
BlockShapePool = new MyBlockShapePool();
TemporaryWorld = new HkWorld(true, 50000, MyPhysics.RestingVelocity, MyFakes.ENABLE_HAVOK_MULTITHREADING, 4);
TemporaryWorld.MarkForWrite();
TemporaryWorld.DestructionWorld = new HkdWorld(TemporaryWorld);
TemporaryWorld.UnmarkForWrite();
Storage = new HkDestructionStorage(TemporaryWorld.DestructionWorld);
// pre-fracture cube blocks
{
foreach (var groupName in MyDefinitionManager.Static.GetDefinitionPairNames())
{
var group = MyDefinitionManager.Static.GetDefinitionGroup(groupName);
if (group.Large != null)
{
var model = MyModels.GetModel(group.Large.Model);
if (model == null)
continue;
bool isGenerated = group.Large.IsGeneratedBlock && (group.Large.GeneratedBlockType == GENERATED_BLOCK_TYPE_PILLAR);
if (!MyFakes.LAZY_LOAD_DESTRUCTION || (model != null && model.HavokBreakableShapes != null)) //reload materials
LoadModelDestruction(group.Large.Model, group.Large, isGenerated, group.Large.Size * (MyDefinitionManager.Static.GetCubeSize(group.Large.CubeSize)));
foreach(var progress in group.Large.BuildProgressModels)
{
model = MyModels.GetModel(progress.File);
if (model == null)
continue;
if (!MyFakes.LAZY_LOAD_DESTRUCTION || (model != null && model.HavokBreakableShapes != null)) //reload materials
LoadModelDestruction(progress.File, group.Large, isGenerated, group.Large.Size * (MyDefinitionManager.Static.GetCubeSize(group.Large.CubeSize)));
}
if (MyFakes.CHANGE_BLOCK_CONVEX_RADIUS)
{
if (model != null && model.HavokBreakableShapes != null)
{
var shape = model.HavokBreakableShapes[0].GetShape();
if(shape.ShapeType != HkShapeType.Sphere && shape.ShapeType != HkShapeType.Capsule)
SetConvexRadius(model.HavokBreakableShapes[0], MyDestructionConstants.LARGE_GRID_CONVEX_RADIUS);
}
}
}
if (group.Small != null)
{
var model = MyModels.GetModel(group.Small.Model);
if (model == null)
continue;
bool isGenerated = group.Small.IsGeneratedBlock && (group.Small.GeneratedBlockType == GENERATED_BLOCK_TYPE_PILLAR);
if (!MyFakes.LAZY_LOAD_DESTRUCTION || (model != null && model.HavokBreakableShapes != null)) //reload materials
LoadModelDestruction(group.Small.Model, group.Small, isGenerated, group.Small.Size * (MyDefinitionManager.Static.GetCubeSize(group.Small.CubeSize)));
foreach (var progress in group.Small.BuildProgressModels)
{
model = MyModels.GetModel(progress.File);
if (model == null)
continue;
if (!MyFakes.LAZY_LOAD_DESTRUCTION || (model != null && model.HavokBreakableShapes != null)) //reload materials
LoadModelDestruction(progress.File, group.Small, isGenerated, group.Large.Size * (MyDefinitionManager.Static.GetCubeSize(group.Large.CubeSize)));
}
if (MyFakes.CHANGE_BLOCK_CONVEX_RADIUS)
{
if (model != null && model.HavokBreakableShapes != null)
{
var shape = model.HavokBreakableShapes[0].GetShape();
if (shape.ShapeType != HkShapeType.Sphere && shape.ShapeType != HkShapeType.Capsule)
SetConvexRadius(model.HavokBreakableShapes[0], MyDestructionConstants.LARGE_GRID_CONVEX_RADIUS);
}
}
}
}
if (!MyFakes.LAZY_LOAD_DESTRUCTION)
BlockShapePool.Preallocate();
}
foreach (var enviroment in MyDefinitionManager.Static.GetEnvironmentItemDefinitions())
{
LoadModelDestruction(enviroment.Model, enviroment, false, Vector3.One, false, true);
}
}
示例3: StepWorld
private static void StepWorld(HkWorld world)
{
world.UnmarkForWrite();
world.StepSimulation(MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS * MyFakes.SIMULATION_SPEED);
world.StepSimulation(MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS * MyFakes.SIMULATION_SPEED);
world.MarkForWrite();
}