public override Scene MakeScene() { Scene scene = new Scene(); Model root = new Model(); Shape shape; string name = "testgeo"; string bricktex = GetMediaPath("brick.jpg"); TriMesh mesh; ExtModel extmodel; scene.Models = root; scene.Name = name + ".scene"; root.Name = name + ".root"; shape = MakeShape(name + ".block", new Col4(1.0f, 0.5f, 0.5f), bricktex, Sampler.DIFFUSE); mesh = (TriMesh)shape.Geometry; GeoUtil.Block(mesh, new Vec3(20.0f, 10.0f, 10.0f)); shape.Translate(-40.0f, 0.0f, 0.0f); root.Append(shape); shape = MakeShape(name + ".sphere", new Col4(0.5f, 1.0f, 0.5f), bricktex, Sampler.DIFFUSE); GeoUtil.Ellipsoid((TriMesh)shape.Geometry, new Vec3(10.0f, 10.0f, 10.0f), 9); root.Append(shape); shape = MakeShape(name + ".torus", new Col4(1.0f, 0.5f, 1.0f), bricktex, Sampler.DIFFUSE); GeoUtil.Torus((TriMesh)shape.Geometry, 5.0f, 10.0f, 15); shape.Translate(30.0f, 20.0f, 0.0f); shape.Turn(new Vec3(1.0f, 0f, 0f), 3.14159f / 2); root.Append(shape); extmodel = new ExtModel(); extmodel.Name = "testgeo.external"; extmodel.FileName = ContentFile; root.Append(extmodel); scene.ShowAll(); return(scene); }
public Puppet(String name, String url, dynamic config) { baseName = name; filename = url; usehavok = false; if (url.ToLower().EndsWith(".hkt")) { IsHavokFile = true; } if (config != null) { if (config.rig != null) { animRig = config.rig; } if (config.havokrig != null) { havokRig = config.havokrig; usehavok = true; } if (config.physics != null) { PhysicsOptions = config.physics; } } bodyModel = new ExtModel(); bodyModel.Options |= ExtModel.REMOVE; hairModel = new ExtModel(); hairModel.Options |= ExtModel.REMOVE | ExtModel.AUTOLOAD; bodyModel.FileName = url; }
internal static void FireAll(DemoModel model, ExtModel extModel) { model.Boolean_property.Set(false); model.Boolean_array.Set(new[] { false, true, false }); var scalar = new MyScalar( false, 50, 32000, 1000000000, -2000000000000000000, 3.14f, -123456789.012345678, byte.MaxValue - 1, ushort.MaxValue - 1, uint.MaxValue - 1, ulong.MaxValue - 1, MyEnum.net, Flags.anyFlag | Flags.netFlag, MyInitializedEnum.hundred ); // ReSharper disable once UnusedVariable // ReSharper disable once InconsistentNaming var(_bool, _byte, _short, _int, _long, _float, _double, _unsigned_byte, unsigned_short, _unsigned_int, _unsigned_long, _my_enum, _flags, initializedEnum) = scalar; var(first, second) = new ComplicatedPair(new Derived("First"), new Derived("Second")); model.Scalar.Set(scalar); model.Set.Add(50); model.MapLongToString.Add(50, "C#"); const string valA = "C#"; const string valB = "protocol"; model.Interned_string.Set(valA); model.Interned_string.Set(valA); model.Interned_string.Set(valB); model.Interned_string.Set(valB); model.Interned_string.Set(valA); var derived = new Derived("C# instance"); model.Polymorphic.Set(derived); var openDerived = new OpenDerived("C# instance open derived string", "C# instance open string"); model.Polymorphic_open.Set(openDerived); var openClass = new OpenClass("c# test"); openClass.String.Set("property"); model.Enum.Value = MyEnum.net; extModel.Checker.Fire(); model.Struct_with_open_field.Value = new StructWithOpenStructField(new OpenStructInField("", "", 456, "", "")); }
/* * Creates initial scene graph. Adds a placeholder object for the 3D UI. */ protected override Model MakeModels() { Model sceneRoot = base.MakeModels(); uiRoot = new ExtModel(); uiRoot.Options |= ExtModel.REMOVE; sceneRoot.Append(uiRoot); return(sceneRoot); }
private void AdviseAll(Lifetime lifetime, DemoModel model, ExtModel extModel) { model.Boolean_property.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Boolean_property, "Boolean_property", it); }); model.Boolean_array.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Boolean_array, "Boolean_array", it); }); model.Scalar.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Scalar, "Scalar", it); }); model.Ubyte.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Ubyte, "Ubyte", it); }); model.Ubyte_array.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Ubyte_array, "Ubyte_array", it); }); model.List.Advise(lifetime, e => { Printer.PrintIfRemoteChange(model.List, "List", e); }); model.Set.Advise(lifetime, e => { Printer.PrintIfRemoteChange(model.Set, "Set", e); }); model.MapLongToString.Advise(lifetime, e => { Printer.PrintIfRemoteChange(model.MapLongToString, "MapLongToString", e); }); /*model.Callback.Set(s => * { * Printer.Print("RdTask:"); * Printer.Print(s); * * return 50; * });*/ model.Interned_string.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Interned_string, "Interned_string", it); }); model.Polymorphic.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Polymorphic, "Polymorphic", it); }); model.Enum.Advise(lifetime, it => { Printer.PrintIfRemoteChange(model.Enum, "Enum", it); if (!model.Enum.IsLocalChange()) { Finished = true; } }); extModel.Checker.Advise(lifetime, () => { Printer.Print("ExtModel:Checker:"); "Unit".PrintEx(Printer); }); }
public Garment(Model root, Skeleton skel, String name) : base(new Dictionary <string, object>() { { "name", name }, { "filename", null }, { "iconfile", null }, { "animation", null }, { "script", null } }) { skeleton = skel; closetRoot = root; clothRoot = new ExtModel(); clothRoot.Options |= ExtModel.REMOVE; clothRoot.Active = false; root.Append(clothRoot); }
protected virtual Model MakeModels() { interiorRoot = new ExtModel(); interiorRoot.Name = "magicmirror.environment"; interiorRoot.Options |= ExtModel.REMOVE; interiorRoot.ExtName = "root"; avatarRoot = new Model(); avatarRoot.Name = "magicmirror.avatars"; garmentRoot = new Model(); garmentRoot.Name = "magicmirror.garments"; sceneRoot = new Model(); sceneRoot.Name = "magicmirror.root"; sceneRoot.Append(interiorRoot); sceneRoot.Append(avatarRoot); sceneRoot.Append(garmentRoot); return(sceneRoot); }
public Garment(dynamic src, Model root, Skeleton skel, Scriptor scp) : base(new Dictionary <string, object>() { { "name", src.name }, { "filename", src.filename }, { "iconfile", src.iconfile }, { "script", src.script }, { "animation", src.animation } }) { closetRoot = root; skeleton = skel; scriptor = scp; clothRoot = new ExtModel(); clothRoot.Options |= ExtModel.REMOVE; clothRoot.Active = false; root.Append(clothRoot); }
static void FireAll(DemoModel model, ExtModel extModel) { model.Boolean_property.Set(false); model.Boolean_array.Set(new[] { false, true, false }); var scalar = new MyScalar(false, 50, 32000, 1000000000, -2000000000000000000, 3.14f, -123456789.012345678, byte.MaxValue - 1, ushort.MaxValue - 1, uint.MaxValue - 1, ulong.MaxValue - 1, MyEnum.net, Flags.anyFlag | Flags.netFlag ); model.Scalar.Set(scalar); model.Set.Add(50); model.MapLongToString.Add(50, "C#"); var valA = "C#"; var valB = "protocol"; // var res = model.get_call().sync(L'c'); model.Interned_string.Set(valA); model.Interned_string.Set(valA); model.Interned_string.Set(valB); model.Interned_string.Set(valB); model.Interned_string.Set(valA); var derived = new Derived("C# instance"); model.Polymorphic.Set(derived); model.Enum.Value = MyEnum.net; extModel.Checker.Fire(); }