本文整理汇总了C#中MyModel.LoadData方法的典型用法代码示例。如果您正苦于以下问题:C# MyModel.LoadData方法的具体用法?C# MyModel.LoadData怎么用?C# MyModel.LoadData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyModel
的用法示例。
在下文中一共展示了MyModel.LoadData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(MyModel model, Matrix matrix, float rescaleModel = 1.0f)
{
Model = model;
model.Rescale(rescaleModel);
InstanceData.LocalMatrix = matrix;
model.LoadData();
}
示例2: LoadModel
void LoadModel(MyModel model)
{
model.LoadData();
m_minCoord = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
m_maxCoord = new Vector3(float.MinValue, float.MinValue, float.MinValue);
MyTriangleVertexIndices[] triangles = model.Triangles;
m_triangles = new List<MyImportTriangle>(triangles.Length);
for (int i = 0; i < triangles.Length; i++)
{
Vector3 vertex0 = model.GetVertex(triangles[i].I0);
Vector3 vertex1 = model.GetVertex(triangles[i].I1);
Vector3 vertex2 = model.GetVertex(triangles[i].I2);
MyImportTriangle triangle = new MyImportTriangle(vertex0, vertex1, vertex2);
// Ignore triangles that lie in XZ plane
if (triangle.Normal.Y != 0)
{
m_triangles.Add(triangle);
CheckMinMaxCoords(vertex0);
CheckMinMaxCoords(vertex1);
CheckMinMaxCoords(vertex2);
}
}
}
示例3: MyExportModel
public MyExportModel(MyModel model)
{
m_model = model;
m_model.LoadData();
ExtractMaterialsFromModel();
}
示例4: ExtractModelDataForObj
private static void ExtractModelDataForObj(
MyModel model,
Matrix matrix,
List<Vector3> vertices,
List<TriangleWithMaterial> triangles,
List<Vector2> uvs,
ref Vector2 offsetUV,
Dictionary<string, MyExportModel.Material> materials,
ref int currVerticesCount,
Vector3 colorMaskHSV)
{
if (false == model.HasUV)
{
model.LoadUV = true;
model.UnloadData();
model.LoadData();
}
MyExportModel renderModel = new MyExportModel(model);
int modelVerticesCount = renderModel.GetVerticesCount();
List<HalfVector2> modelUVs = GetUVsForModel(renderModel, modelVerticesCount);
Debug.Assert(modelUVs.Count == modelVerticesCount, "wrong UVs for model");
if (modelUVs.Count != modelVerticesCount)
{
return;
}
//we need new material for every HSV and texture combination, therefore we need to create new materials for each model
List<MyExportModel.Material> newModelMaterials = CreateMaterialsForModel(materials, colorMaskHSV, renderModel);
for (int i = 0; i < modelVerticesCount; ++i)
{
vertices.Add(Vector3.Transform(model.GetVertex(i), matrix));
Vector2 localUV = modelUVs[i].ToVector2()/model.PatternScale + offsetUV;
uvs.Add(new Vector2(localUV.X, -localUV.Y));
}
for (int i = 0; i < renderModel.GetTrianglesCount(); ++i)
{
int matID = -1;
for (int j = 0; j < newModelMaterials.Count; ++j)
{
if (i <= newModelMaterials[j].LastTri)
{
matID = j;
break;
}
}
Debug.Assert(matID != -1, "Triangle with no material");
var t = renderModel.GetTriangle(i);
string materialName = "EmptyMaterial";
if (matID != -1)
{
materialName = newModelMaterials[matID].Name;
}
triangles.Add(new TriangleWithMaterial()
{
triangle = new MyTriangleVertexIndices(t.I0 + 1 + currVerticesCount, t.I1 + 1 + currVerticesCount, t.I2 + 1 + currVerticesCount),
material = materialName,
});
}
currVerticesCount += modelVerticesCount;
}
示例5: HandleUnhandledInput
//.........这里部分代码省略.........
}
/*if (input.IsNewKeyPress(Keys.F10) && input.IsAnyCtrlKeyPressed() && !MyModelsStatisticsConstants.GET_MODEL_STATISTICS_AUTOMATICALLY)
{
MyModelsStatisticsConstants.GET_MODEL_STATISTICS_AUTOMATICALLY = true;
if (MyModelsStatisticsConstants.MISSIONS_TO_GET_MODEL_STATISTICS_FROM.Length == 0)
{
int i = 0;
MyModelsStatisticsConstants.MISSIONS_TO_GET_MODEL_STATISTICS_FROM = new Missions.MyMissionID[Missions.MyMissions.Missions.Count];
foreach (var mission in MyMissions.Missions.Values.OfType<MyMission>().OrderBy(x => x.Name.ToString()))
{
if (i >= 12)
MyModelsStatisticsConstants.MISSIONS_TO_GET_MODEL_STATISTICS_FROM[i] = mission.ID;
i++;
}
}
GUI.MyGuiScreenMainMenu.StartMission(MyModelsStatisticsConstants.MISSIONS_TO_GET_MODEL_STATISTICS_FROM[0]);
}*/
// Voxel import
if (MyFakes.VOXEL_IMPORT && input.IsNewKeyPress(Keys.PageUp))
{
if (!input.IsAnyShiftKeyPressed())
{
MyVoxelMap voxelMap = new MyVoxelMap();
//{
// // TODO: merge
// //VoxelMaterial = MyMwcVoxelMaterialsEnum.Stone_01,
// Size = MyFakes.VOXEL_IMPORT_SIZE
//};
voxelMap.Init(Vector3.Zero, MyFakes.VOXEL_IMPORT_SIZE, MyMwcVoxelMaterialsEnum.Stone_01);
MyModel model = new MyModel(MyFakes.VOXEL_IMPORT_MODEL, MyMeshDrawTechnique.MESH, MyModelsEnum.ExplosionDebrisVoxel);
model.LoadData();
MyVoxelImport.Run(voxelMap, model, MyVoxelImportOptions.KeepAspectRatio);
voxelMap.SaveVoxelContents(Path.Combine(MyMinerGame.Static.RootDirectory, "VoxelMaps", MyVoxelFiles.ExportFile + ".vox"));
// Reload sector
MyGuiScreenGamePlay.Static.Restart();
}
else
{
int[] sizes = new int[] { 64, 128, 256, 512 };
List<MyMwcVector3Int> voxelSizes = new List<MyMwcVector3Int>();
for (int x = 0; x < sizes.Length; x++)
{
int lo = Math.Max(x - 1, 0);
int hi = Math.Min(x + 2, sizes.Length);
for (int y = lo; y < hi; y++)
{
for (int z = lo; z < hi; z++)
{
voxelSizes.Add(new MyMwcVector3Int(sizes[x], sizes[y], sizes[z]));
}
}
}
foreach (var size in voxelSizes)
{
MyVoxelMap voxelMap = new MyVoxelMap();
voxelMap.Init(Vector3.Zero, size, MyMwcVoxelMaterialsEnum.Stone_01);
示例6: Init
public void Init(MyModel model, Matrix matrix)
{
Model = model;
InstanceData.LocalMatrix = matrix;
model.LoadData();
}