private void objectFromTemplate() { PhysModel curModel; switch (template.useType) { case Template.UseType.Animated: curModel = new AnimatedModel(Scene); break; default: curModel = new PhysModel(Scene); break; } curModel.Materials = template.materials; curModel.Meshes = template.meshes; curModel.Position = ghost.Position; curModel.PhysBoxes = template.pmeshes; curModel.IsStatic = template.isStatic; curModel.Name = Scene.getUniqueName(); curModel.Orientation = ghost.Orientation; if (template.hasLight && Scene.lightCount < ShaderLoader.maxNoLights) { Light mLight = new LightSpot(curModel); mLight.Color = new Vector4(template.lightColor, 1); } }
protected void genericLoad(ref XmlTextReader reader, string type) { if (reader.Name == PhysModel.nodename) { string childname = scene.getUniqueName(); while (reader.MoveToNextAttribute()) { if (reader.Name == "name") childname = reader.Value; } GameObject child = new PhysModel(this); child.Name = childname; child.load(ref reader, "pmodel"); } if (reader.Name == AnimatedModel.nodename) { string childname = scene.getUniqueName(); while (reader.MoveToNextAttribute()) { if (reader.Name == "name") childname = reader.Value; } GameObject child = new AnimatedModel(this); child.Name = childname; child.load(ref reader, "animodel"); } if (reader.Name == MetaModel.nodename) { string childname = scene.getUniqueName(); while (reader.MoveToNextAttribute()) { if (reader.Name == "name") childname = reader.Value; } GameObject child = new MetaModel(this); child.Name = childname; child.load(ref reader, "metamodel"); } if (reader.Name == LightSpot.nodename) { string childname = scene.getUniqueName(); while (reader.MoveToNextAttribute()) { if (reader.Name == "name") childname = reader.Value; } GameObject child = new LightSpot(this); child.Name = childname; child.load(ref reader, "lamp"); } if (reader.Name == "position" && reader.NodeType != XmlNodeType.EndElement) { reader.Read(); Position = GenericMethods.VectorFromString(reader.Value); } if (reader.Name == "direction" && reader.NodeType != XmlNodeType.EndElement) { reader.Read(); PointingDirection = GenericMethods.VectorFromString(reader.Value); } if (reader.Name == "color" && reader.NodeType != XmlNodeType.EndElement) { reader.Read(); Color = new Vector4(GenericMethods.VectorFromString(reader.Value),1); } if (reader.Name == "rotation" && reader.NodeType != XmlNodeType.EndElement) { reader.Read(); Orientation = GenericMethods.ToOpenTKMatrix(GenericMethods.JMatrixFromString(reader.Value)); } }