本文整理汇总了C#中ModelObject.Load方法的典型用法代码示例。如果您正苦于以下问题:C# ModelObject.Load方法的具体用法?C# ModelObject.Load怎么用?C# ModelObject.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelObject
的用法示例。
在下文中一共展示了ModelObject.Load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public bool Load(Stream rsw, Map owner)
{
BinaryReader br = new BinaryReader(rsw);
string header = ((char)br.ReadByte()).ToString() + ((char)br.ReadByte()) + ((char)br.ReadByte()) + ((char)br.ReadByte());
if (header != "GRSW")
return false;
majorVersion = br.ReadByte();
minorVersion = br.ReadByte();
if (!(majorVersion == 1 && minorVersion >= 2 && minorVersion <= 9) &&
!(majorVersion == 2 && minorVersion <= 2))
return false;
_iniFile = br.ReadCString(40);
_groundFile = br.ReadCString(40);
_altitudeFile = br.ReadCString(40);
_scrFile = br.ReadCString(40);
_waterInfo.Load(br, majorVersion, minorVersion);
_lightInfo.Load(br, majorVersion, minorVersion);
_groundInfo.Load(br, majorVersion, minorVersion);
_models = new List<ModelObject>();
Logger.TabLevel++;
int count = br.ReadInt32();
for (int i = 0; i < count; i++)
{
int type = br.ReadInt32();
int skipSize = 0;
if (type == 1)
{
ModelObject mo = new ModelObject();
mo.Load(br, majorVersion, minorVersion, owner.Ground);
Vector3 tmp = mo.Position;
tmp.X = (mo.Position.X / 5) + owner.Ground.Width;
tmp.Z = (mo.Position.Z / 5) + owner.Ground.Height;
mo.Position = tmp;
_models.Add(mo);
}
else if (type == 2)
{
skipSize = 80 + sizeof(float) * 3 + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(float);
}
else if (type == 3)
{
skipSize = 80 + 80 + sizeof(float) * 3 + sizeof(float) + sizeof(int) + sizeof(int) + sizeof(float);
if (majorVersion >= 2)
skipSize += sizeof(float);
}
else if (type == 4)
{
skipSize = 80 + sizeof(float) * 3 + sizeof(int) + sizeof(float) + sizeof(float) * 4;
}
if (skipSize > 0)
br.ReadBytes(skipSize);
}
Logger.TabLevel--;
Logger.WriteLine("Loading water type {0} textures...", _waterInfo.Type);
SetupWater(_waterInfo.Type);
Logger.WriteLine("Creating water vertex buffer...");
UpdateWaterVertices(owner);
Logger.WriteLine("World v{0}.{1} status: {2} objects - {3} models", majorVersion, minorVersion, count, _models.Count);
Logger.WriteLine(" Water height: {0}", _waterInfo.Level);
Logger.WriteLine(" Water type: {0}", _waterInfo.Type);
return true;
}