本文整理汇总了C#中Loader.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# Loader.Parse方法的具体用法?C# Loader.Parse怎么用?C# Loader.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader.Parse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EquipmentTemplate
public EquipmentTemplate(Loader l)
{
ID = l.ID;
foreach (Instruction i in l.Parse())
Load(l, i);
}
示例2: Skeleton
public Skeleton(Loader l)
{
ID = l.ID;
foreach (Instruction i in l.Parse())
Load(l, i);
}
示例3: ModelObject
public ModelObject(Loader l)
{
GeometryModel3D model = null;
MeshGeometry3D geometry = null;
List<Point3D> vertices = new List<Point3D>();
List<Vector3D> normals = new List<Vector3D>();
List<Point> textures = new List<Point>();
foreach (Instruction i in l.Parse())
{
switch (i.Type)
{
case "mtllib":
MaterialLibrary = l.Find(i.Arg).Load<MaterialLibrary>();
break;
case "usemtl":
model.Material = MaterialLibrary.Materials[i.Arg];
break;
case "o":
model = new GeometryModel3D();
Geometries.Add(i.Arg, model);
model.Geometry = geometry = new MeshGeometry3D();
break;
case "f":
foreach (string index in i.Args)
{
string[] values = index.Split('/');
geometry.Positions.Add(vertices[int.Parse(values[0]) - 1]);
if (values.Length > 1 && values[1] != "")
geometry.TextureCoordinates.Add(
textures[int.Parse(values[1]) - 1]);
if (values.Length > 2)
geometry.Normals.Add(normals[int.Parse(values[2]) - 1]);
}
break;
case "v": // Vertex
vertices.Add(new Point3D(i.Double(), i.Double(), i.Double()));
break;
case "vn": // Vertex normal
normals.Add(new Vector3D(i.Double(), i.Double(), i.Double()));
break;
case "vt": // Vertex texture coordinate
textures.Add(new Point(i.Double(), i.Double()));
break;
case "g": // Group
// TODO: Add support for object groups
break;
case "s": // Smooth
// Not supported, just ignore
break;
default:
break;
}
}
}
示例4: Control
public Control(Loader l)
{
foreach (Instruction i in l.Parse())
{
switch (i.Type)
{
case "name":
Name = i.String();
break;
case "startup":
if (i.Bool())
Event.Once(typeof(Game), Game.Loaded, (sender, e) => Start());
break;
}
}
}
示例5: MaterialLibrary
public MaterialLibrary(Loader l)
{
MaterialGroup group = null;
DiffuseMaterial diffuse = null;
SpecularMaterial specular = null;
foreach (Instruction i in l.Parse())
{
switch (i.Type)
{
case "newmtl":
group = new MaterialGroup();
diffuse = new DiffuseMaterial();
group.Children.Add(diffuse);
specular = new SpecularMaterial();
group.Children.Add(specular);
Materials.Add(i.Arg, group);
break;
case "Ns":
specular.SpecularPower = i.Double();
break;
case "d":
case "Tr":
diffuse.Brush.Opacity = i.Float();
break;
case "Ka":
diffuse.AmbientColor = i.Color();
break;
case "Kd":
diffuse.Brush = new SolidColorBrush(i.Color());
break;
case "Ks":
specular.Brush = new SolidColorBrush(i.Color());
break;
// TODO: UV Maps
case "illum":
case "Ni": // Index of Refraction
// Unsupported, ignore
break;
default:
// Unrecognized symbol
break;
}
}
}
示例6: Cam
public Cam(Loader l)
{
// TODO: Set transformation to follow Scene
CamAnimation anim = null;
foreach (Instruction i in l.Parse())
{
switch (i.Type)
{
case "track":
TrackTarget = i.Bool();
break;
case "pos":
if (anim == null)
Position = i.Point3D();
else
anim.Position = i.Point3D();
break;
case "tar":
if (anim == null)
Target = i.Point3D();
else
anim.Target = i.Point3D();
break;
case "dir":
if (anim == null)
LookDirection = i.Vector3D();
else
anim.LookDirection = i.Vector3D();
break;
case "anim":
Animations[i.String()] = anim = new CamAnimation(this);
break;
case "ease":
anim.Easing = Easings.Map[i.String()];
break;
case "abs":
anim.IsAbsolute = i.Bool();
break;
case "dur":
anim.Duration = i.Double();
break;
default:
break;
}
}
}
示例7: AddonTemplate
public AddonTemplate(Loader l)
{
ID = l.ID;
foreach (Instruction i in l.Parse())
{
switch (i.Type)
{
case "node":
Node = i.String();
break;
case "model":
Model = l.Find(i.String()).Load<ModelObject>();
break;
}
}
}
示例8: InteractionTemplate
public InteractionTemplate(Loader l)
{
foreach (Instruction i in l.Parse())
Load(l, i);
}